Time remaining
:
:
Test Status
CRANDOMTEST
Ques 1 :
What is the output of following program?
void main(){
int i;
for(i=1;i++<=1;i++)
i++;
printf("%d",i);
}
(A) 4
(B) 5
(C) 6
(D) nothing display on screen
Ques 2 :
What will be printed as the result of the operation below:
main()
{
int x=5;
printf("%d,%d,%d",x,x< <2,x>>2);
}
(A) 1
(B) 5,20,1
(C) 0
(D) Compilation Error
Ques 3 :
What is the output of following program?
void main(){
int a=1;
a=a<<15;
printf("%d",a);
}
(A) 32767
(B) -32767
(C) 32768
(D) -32768
Ques 4 :
What is the output of following program?
void main(){
int a=2;
switch(a)
{
case 1: printf("A");
break;
case 2: printf("B");
continue;
case 3: printf("C");
break;
case 4; printf("D");
default: printf("E");
}
}
(A) B E
(B) B C E
(C) B C D E
(D) error
Ques 5 :
What the below statement will print if a=10 and b = 20?
printf("%d",a==b);
(A) 20
(B) 10
(C) 1
(D) 0
Ques 6 :
int x[] = { 1, 4, 8, 5, 1, 4 };
int *ptr, y;
ptr = x + 4;
y = ptr - x;
What does y in the sample code above equal?
(A) -3
(B) 0
(C) 4
(D) 4 + sizeof( int )
Ques 7 :
What is the output of the following code?
#include "stdio.h"
extern int a;
main(){
printf("\n a=%d",a);
return 0;
}
int a;
(A) a=0
(B) error
(C) nothing display on screen
(D) none of these
Ques 8 :
What will be the output of the following program if the base address of array is 100.
main()
{
int gyan[] = { 1,2,3,4,5 };
int i,*ptr ;
ptr = gyan;
for(i = 0; i<=4 ; i++)
{
print("\n %d", *ptr++);
}
}
(A) 1 2 3 4 5
(B) 2 3 4 5
(C) 100 101 102 103
(D) 101 102 103 104
Ques 9 :
what is the output of following program?
void main(){
int a;
a=1;
while(a-->=1)
while(a-->=0);
printf("%d",a);
}
(A) 3
(B) -3
(C) 0
(D) error
Ques 10 :
what is the output of following program?
void main(){
int a;
a=100;
printf("%d%d",++a,a++);
}
(A) 101 101
(B) 101 102
(C) 102 100
(D) 102 101
Ques 11 :
What is the output of following program?
void abc(int a){
++a;
printf("%d",a);
}
void main(){
int a=10;
abc(++a);
abc(a++);
printf("%d",a);
}
(A) 11 12 12
(B) 11 12 13
(C) 12 12 12
(D) 12 12 13
Ques 12 :
What will be the output
main()
{
int i;
i = 10;
if(i == 20 || 30)
{
printf("True");
}
else
{
printf("False");
}
}
(A) True
(B) False
(C) Syntax Error
(D) Run time Error
Ques 13 :
What will be output of following program?
#include<stdio.h>
int main(){
int a = 320;
char *ptr;
ptr =( char *)&a;
printf("%d ",*ptr);
return 0;
}
(A) 2
(B) 64
(C) 320
(D) None of above
Ques 14 :
What the below statement will print if a=10
printf("%d %d",a, !a++);
(A) 11 0
(B) 10 10
(C) 10 0
(D) 0 10
Ques 15 :
What is the output of following program?
void main(){
printf("%d%d%d",10<<1, 10>>1, ~10);
printf("%d%d%d",10^20, 10|20, 10&20);
}
(A) 20 5 -11 30 30 1
(B) 20 5 -9 30 30 0
(C) 5 20 -11 30 30 0
(D) 20 5 -11 30 30 0
Ques 16 :
What is the output of the following program?
void main(){
int a;
a=100>90>80;
printf("%d",a);
}
(A) 0
(B) 1
(C) error
(D) none of these
Ques 17 :
What will be output when you will execute following code?
void main(){
if(!10>-10)
printf("C");
else
printf("C++");
}
(A) C
(B) C++
(C) nothing display on screen
(D) none of these
Ques 18 :
What is the output of following program?
void main(){
float a;
a=8.5;
if(a==8.5)
printf("1");
else
printf("2");
}
(A) 1
(B) 2
(C) error
(D) none of these
Ques 19 :
What will be output of following program?
#include<stdio.h>
int main()
{
int a = 320;
char *ptr;
ptr = (char *)&a;
printf("%d",*ptr);
return 0;
}
(A) 2
(B) 320
(C) 64
(D) Compilation Error
Ques 20 :
How many times the below loop will get executed?
main()
{
int i;
for(i=9;i;i=i-2)
{
printf("\n%d",i);
}
}
(A) 5
(B) 6
(C) Compilation Error
(D) Infinite
Submit Answer
Don't Refresh the Page !! ...