C Programming Language Quiz - 1

C Programming Language Quiz - 1

10 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

if ( 16 = m ) printf("m is 16");

  1. is correct
  2. has syntax error
  3. causes run-time error
  4. none of the above
Question 2 Multiple Choice (Single Answer)

To copy a string into another, given:
char s1[30] = "xyz", s2[20];

  1. s2 = s1;
  2. strcpy(s2,s1);
  3. s2 == s1;
  4. all three are wrong
Question 3 Multiple Choice (Single Answer)

If LSB of a binary number is "0" then it is:

  1. Positive number
  2. Even number
  3. Odd number
  4. Prime number
Question 4 Multiple Choice (Single Answer)

consider the following statement:

while ( 1 ) ;

  1. Infinite loop
  2. Syntax error
  3. Depends on the compiler
  4. none of the above
Question 5 Multiple Choice (Single Answer)

What is the output of the following piece of code?

int x = 3, y = 5, z;
z = x + ++y;

printf(“%d”,z);
  1. 8
  2. 9
  3. 10
  4. 11
Question 6 Multiple Choice (Single Answer)

The highest digit in any number system equals:

  1. Zero
  2. Base - 1
  3. Base 1
  4. none of the above
Question 7 Multiple Choice (Single Answer)

The main() function is:

  1. to write output to the screen
  2. the program entry point
  3. Both correct
  4. Both wrong
Question 8 Multiple Choice (Single Answer)

To get a statement from the user input in the array char s[100]:

  1. gets( s[100] );
  2. gets( s[] );
  3. gets( s );
  4. none of the above
Question 9 Multiple Choice (Single Answer)

what is the output of the following program

int change( int x ) {
 x = 7;
}

main(){
 int x = 5;
 change(x);
 printf(“%d”,x);	
}
  1. 5
  2. 7
  3. 9
  4. unknown
Question 10 Multiple Choice (Single Answer)

What is the output of the following piece of code:

int x = 7;
if ( x = 3 ) printf( “%d“ , x);
  1. no output
  2. 7
  3. 3
  4. 5