C Programming Language Quiz - 1
C Programming Language Quiz - 1
Questions
Question 1 Multiple Choice (Single Answer)
if ( 16 = m ) printf("m is 16");
- is correct
- has syntax error
- causes run-time error
- none of the above
Question 2 Multiple Choice (Single Answer)
To copy a string into another, given:char s1[30] = "xyz", s2[20];
- s2 = s1;
- strcpy(s2,s1);
- s2 == s1;
- all three are wrong
Question 3 Multiple Choice (Single Answer)
If LSB of a binary number is "0" then it is:
- Positive number
- Even number
- Odd number
- Prime number
Question 4 Multiple Choice (Single Answer)
consider the following statement:
while ( 1 ) ;
- Infinite loop
- Syntax error
- Depends on the compiler
- 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);
- 8
- 9
- 10
- 11
Question 6 Multiple Choice (Single Answer)
The highest digit in any number system equals:
- Zero
- Base - 1
- Base 1
- none of the above
Question 7 Multiple Choice (Single Answer)
The main() function is:
- to write output to the screen
- the program entry point
- Both correct
- Both wrong
Question 8 Multiple Choice (Single Answer)
To get a statement from the user input in the array char s[100]:
- gets( s[100] );
- gets( s[] );
- gets( s );
- 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);
}
- 5
- 7
- 9
- 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);
- no output
- 7
- 3
- 5