C And C++ Questions: Trivia Quiz!

10 Questions | Total Attempts: 65

SettingsSettingsSettings
Please wait...
C And C++ Questions: Trivia Quiz!

.


Questions and Answers
  • 1. 
    C is a:
    • A. 

      Client-side scripting language

    • B. 

      General purpose programming language

    • C. 

      Movie making program

    • D. 

      All

  • 2. 
    What should be used to move the cursor to a new line?
    • A. 

      \a

    • B. 

      \t

    • C. 

      \n

    • D. 

      \r

  • 3. 
    Which two statements are true for variables in C++?
    • A. 

      The variable name may be same as the keyword in c++/c

    • B. 

      Variables must have a data type

    • C. 

      Variables must be declared before their use

    • D. 

      Variables are pre-processor directives

  • 4. 
    Following program prints  #include<stdio.h>  int main() {      int i = 65;      char j = 'A';      if(i==j)             printf(" C is WOW  \n");     else              printf(" C is a headache \n");      return 0; }  
    • A. 

      C is WOW

    • B. 

      C is a headache

    • C. 

      C is WOO

    • D. 

      Error

  • 5. 
    In which line there is an error in the program 1 #include<stdio.h> 2 int main() 3 { 4       int size; 5       scanf("%d",&size); 6       int arr[size]; 7       for(int i =0 ; i<=size ; i++) 8       { 9                    scanf("%d" , &arr[i]); 10                   printf("%d", arr[i]);    11      } 12      return 0; 13 }
    • A. 

      1

    • B. 

      5

    • C. 

      6

    • D. 

      9

  • 6. 
    What is the output of the following program. #include<iostream.h> void main() {          int a = 5;          if(a = 10)            {   cout << " You are correct ";         }           else               {     cout << " You are incorrect";   }               }  
    • A. 

      You are correct

    • B. 

      You are incorrect

    • C. 

      None

    • D. 

      Compilation error

  • 7. 
    What is the output of the following program #include<stdio.h> void main( ) {      int a = 2;        if( a== 2 || ++a )        {     printf("%d", a);    } }
    • A. 

      4

    • B. 

      1

    • C. 

      2

    • D. 

      3

  • 8. 
    What is the output of following program  #include<stdio.h> void main( ) {        int a =5;        int *p = &a;         printf("%d %d ", a,*p);        *p = 7;          printf("%d %d", a,*p); }
    • A. 

      55 77

    • B. 

      55 55

    • C. 

      57 57

    • D. 

      77 55

  • 9. 
    What is the output of following program  #include<stdio.h> void main( ) {       int i =6;       do{              --i;              printf(" %d ",i);          } while(i>0); }  
    • A. 

      543210

    • B. 

      123456

    • C. 

      654321

    • D. 

      54321