2. 1Q - What is the outpout of the following program?
#include<stdio.h>
main() {
enum {
india, is=7, GREAT
};
printf("%d %d", india, GREAT);
}
A - 0 1.
B - 0 2
C - 0 8
D - Compile error
3. 2Q - What is the output of the following program?
#include<stdio.h>
main() { }
A - No output
B - Garbage
C - Compile error
D - Runtime error
4. 3Q - What is the output of the following program?
#include<stdio.h>
main() {
int i = 1;
while( i++<=5 )
printf("%d ",i++);
}
A - 1 3 5
B - 2 4
C - 2 4 6
D - 2
5. 4Q - Choose the application option for the following program?
#include<stdio.h>
main() {
int *p, **q;
printf("%un", sizeof(p));
printf("%un", sizeof(q));
}
A - Both the printf() will print the same value
B - First printf() prints the value less than the second.
C - Second printf() prints the value less than the first.
D - Error in the code.
6. 5Q - Following is the invalid inclusion of a file to the current program.
Identify it.
A - #include <file>
B - #include “file”
C - #include < file
D - All of the above are invalid.
7. 6Q - What is the output of the following program?
#include<stdio.h>
void f() {
static int i = 3;
printf("%d ", i);
if(--i) f();
}
main() {
f();
}
A - 3 2 1 0
B - 3 2 1
C - 3 3 3
D - Compile error
8. 7Q - In the following code, what is 'P'?
Typedef char *charp; const charp P;
A - P is a constant
B - P is a character type
C - P is a pointer
D - None of the above
9. 8Q - int x=~1; What is the value of 'x'?
A - 1
B - -1
C - 2
D - -2
10. 9Q - The correct order of evaluation for the expression “z = x + y * z / 4 % 2 –
1”
A - * / % = + -
B - / * % - + =
C - - + = * % /
D - * / % + - =
11. 10Q - In the given below code, what will be the value of a variable x?
#include<stdio.h>
int main() {
int y = 100;
const int x = y;
printf("%dn", x);
return 0;
}
A - 100
B - 0
C - Print x
D - Return Error