Time remaining
:
:
Test Status
CRANDOMTEST
Ques 1 :
What is the output of following program?
void main(){
int a=2;
switch(a)
{
case 1: printf("A");
case 2: printf("B");
case 3: printf("C");
break;
case 4: printf("D");
default : printf("E");
break;
}
}
(A) B C
(B) B D
(C) B E
(D) error
Ques 2 :
What will be printed as the result of the operation below:
main()
{
char s1[]="Cisco"
char s2[]= "systems";
printf("%s",s1);
}
(A) system
(B) error
(C) Cisco
(D) Compilation fail
Ques 3 :
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 4 :
What value of c will get printed
main()
{
int a,b,c;
a=10;
b=20;
c=printf("%d",a)+ ++b;
printf("%d",c);
}
(A) 23
(B) 22
(C) 30
(D) Compilation Error
Ques 5 :
What will be the output of the following program
void main( ){
int a=10;
printf("%d",a);
{
int a=20;
printf("%d",a);
}
printf("%d",a);
}
(A) 10 10
(B) 20 10
(C) 10 20 10
(D) 10 10 10
Ques 6 :
What is the output of the following program?
void xyz(int p1, int *p2){
++p1;
++*p2;
printf("%d%d",p1,*p2);
}
void main(){
int a=10;
xyz(a++,++*(&a));
xyz(a++,++*(&a));
printf("%d",a);
}
(A) 10 11 13 14 14
(B) 11 12 14 15 15
(C) 12 13 15 16 16
(D) 11 12 13 14 14
Ques 7 :
What is the output of the following program?
void main(){
int a,b;
a=b=10;
while(a)
{
a=b++<=13;
printf("%d%d",a,b);
}
printf("%d%d",a+10,b+10);
}
(A) 1 11 1 12 1 13 1 14 0 15 a=10 b=25
(B) 0 11 1 12 1 13 1 14 0 15 a=10 b=25
(C) 1 11 1 12 1 13 1 14 0 15 a=11 b=25
(D) 0 11 1 12 1 13 1 14 0 15 a=10 b=25
Ques 8 :
What is the output of the following code?
#include "stdio.h"
extern int a;
main(){
printf("\n a=%d",a);
return 0;
}
int a=5;
(A) a=0
(B) a=5
(C) a=garbage value
(D) error
Ques 9 :
What will be the output
main()
{
char *ptr = "Pskills.org";
char a =
printf("%c", ++*ptr++);
}
(A) Compilation Error
(B) Q
(C) P
(D) a
Ques 10 :
What will be printed as the result of the operation below:
main()
{
int x=20,y=35;
x=y++ + x++;
y= ++y + ++x;
printf("%d%d",x,y);
}
(A) 5 7 8 4
(B) 5 7 9 4
(C) 5 8 9 4
(D) 5 7 9 5
Ques 11 :
what is the output of following program?
void main(){
printf("One");
if(2>1)
printf("Two");
else
printf("Three");
printf("Four");
}
(A) One Two Three
(B) Two Three Four
(C) One Two Four
(D) One Three Four
Ques 12 :
What will be output when you will execute following code?
void main(){
printf("%d",-2&&2);
}
(A) 0
(B) 1
(C) -2
(D) 2
Ques 13 :
What will be the output of the following program?
main()
{
printf("%c","Pskills"[4]);
}
(A) Compilation Error
(B) P
(C) i
(D) l
Ques 14 :
What will be printed as the result of the operation below:
#define swap(a,b) a=a+b;b=a-b;a=a-b;
void main()
{
int x=5, y=10;
swap (x,y);
printf("%d %d",x,y);
swap2(x,y);
printf("%d %d",x,y);
}
int swap2(int a, int b)
{
int temp;
temp=a;
b=a;
a=temp;
return 0;
}
(A) 5,10
(B) 10,5
(C) 0,5
(D) 10,0
Ques 15 :
How many times the below loop will get executed?
main()
{
int i;
for(i=20, i=10; i<=20; i++)
{
printf("\n %d", i);
}
}
(A) 1
(B) Run time Error
(C) 11
(D) Compilation Error
Ques 16 :
What is the output of following program?
void main(){
int a;
a='a'>'A';
printf("%d",a);
}
(A) 0
(B) 1
(C) garbage
(D) none of these
Ques 17 :
What is the output of the following program?
void main(){
int a;
a=1;
a++ * ++a;
printf("%d",a);
}
(A) 3
(B) 4
(C) 6
(D) 2
Ques 18 :
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 19 :
int a=10,b;
b=a++ + ++a;
printf("%d,%d,%d,%d",b,a++,a,++a);
what will be the output when following code is executed
(A) 12,11,11,11
(B) 12,10,11,13
(C) 22,10,11,13
(D) 22,13,13,13
Ques 20 :
Consider the following program,
main ()
{
int i, j;
for (i=0, j=5; j >0, i < 10; i ++, j--)
printf("\nGyantonic.com");
}
How many times "Gyantonic.com" will get printed
(A) 5
(B) Compilation Error
(C) 10
(D) None of the above
Submit Answer
Don't Refresh the Page !! ...