WorksheetsQuiz Pratispardha
Total questions: 20
Worksheet time: 15mins
Find the output of following code :
main()
{
static int var = 5; printf("%d ",var--); if(var)
main();
}
54321
5555
Compilation Error
No Output
Find the output of Following Code :
main()
{
char *p;
printf("%d %d ",sizeof(*p),sizeof(p));
}
1 1
1 2
2 2
Garbage Value
void main()
{
printf(“%d”, 11 ^ 5);
}
What does the operation shown above produce?
1
6
8
14
int x = 0;
for (x=1; x<3; x++);
printf("x=%d\n", x);
What will be printed when the sample code above is executed?
x=0
x=1
x=3
x=4
#define j 5+3
int main()
{
printf("j=%d",j*j*j);
return 0;
}
What will be printed when the sample code above is executed?
j=512
j=38
j=133
Compilation error
#define clrscr() 100
int main() {
clrscr();
printf("%d",clrscr());
return 0; }
What will be printed when the sample code above is executed?
100
null
Compiler Error
200
int main(){
int i=0;
do{
--i;
printf("%d",i);
i++;
}while(i>=0);
return 0; }
How many times the above loop will run?
1
0
Compiler Error
Infinite
#include<stdio.h>
int main()
{
int i=-3, j=2, k=0, m;
m = ++i && ++j && ++k;
printf("%d, %d, %d, %d\n", i, j, k, m);
return 0;
}
-2, 3, 1, 1
2, 3, 1, 2
1, 2, 3, 1
3, 3, 1, 2
What would be the equivalent pointer expression for referring to the array element a[i][j][k][l]?
(((*(a+i)+j)+k)+l)
*(*(*(*(a+i)+j)+k)+l)
(*(*(a+i)+j)+k+l)
*((a+i)+j+k+l)
Left shifting a number by 1 is always equivalent to multiplying it by 2.
True
False
Bitwise & and | are not unary operators
True
False
h e
e l
h h
e e
23, 11
23, 23
11, 17
17, 17
15, 10
15, 15
10, 15
10, 10
Variable ‘a’ should be replaced by ‘si’
Nothing will print
Error: Multiple declaration of si
No error
5, 4
5, 5
4, 4
3, 4
70
Garbage value
Compilation error
None
Infinite times
32767
65535
Till stack overflows
Compile time error
4
1
2
An integer array of size 10 is declared in a C program. The memory location of the first byte of the array is 1000. What will be the location of the 8th element of the array? (Assume integer takes 4 bytes of memory and the element stored at 1000 is identified as 1st element).
1028
1032
1024
1036
