Time remaining
:
:
Test Status
CRANDOMTEST
Ques 1 :
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 2 :
What will be output when you will execute following c code?
#include<stdio.h>
int main(){
signed x,a;
unsigned y,b;
a=(signed)10u;
b=(unsigned)-10;
y = (signed)10u + (unsigned)-10;
x = y;
printf("%d %u\t",a,b);
if(x==y)
printf("%d %d",x,y);
else if(x!=y)
printf("%u %u",x,y);
return 0;
}
(A) 10 -10 0 0
(B) 10 -10 65516 -10
(C) 10 65526 0 0
(D) 10 -10 10 -10
Ques 3 :
What are storage classes in 'C' language? choose multiple-
a. auto keyword
b. static keyword
c. register keyword
d. extern keyword
e. automatic
f. static
(A) a,b,c
(B) a,b,c,d
(C) e,f
(D) none of these
Ques 4 :
Given the following program fragment
main ()
{
int i, j, k;
i = 3;
j =2*(i++);
k =2*(++i);
}
which one of the given option is correct?
(A) j = 6, k = 10.
(B) i = 5, k = 6
(C) j = 6, k = 8.
(D) i = 4, j = 6.
Ques 5 :
What will be output when you will execute following code?
#include "stdio.h"
int main(){
char a=250;
int expr;
expr= a+ !a + ~a + ++a;
printf("%d",expr);
return 0;
}
(A) 249
(B) 250
(C) -6
(D) 0
Ques 6 :
What is the output of following program?
void f1(){
extern int g;
static int s=5;
int a;
++g;
a=s++;
printf("%d%d%d",a,s,g);
if(a<=6)
f1();
printf("%d%d%d",a,s,g);
}
void f2(){
static int s;
int a;
a=++s;
++g;
printf("%d%d%d",a,s,g);
if(a<=2)
f2();
printf("%d%d%d",a,s,g);
}
main(){
f1();
f2();
}
(A) 0 5 garbase
(B) 1 6 1
(C) 1 6 2
(D) error
Ques 7 :
What is the output of following program?
void f1(){
static int s=5;
++s;
printf("%d",s);
}
main(){
f1();
f1();
printf("%d",s);
}
(A) 6 6 6
(B) 6 7 7
(C) 6 7 6
(D) error
Ques 8 :
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 9 :
What is the output of following program?
void main(){
int a;
a=1;
while(a<=10){
printf("%d",a);
if(a>3 && a<8)
continue;
a++;
}
printf("%d",a+10);
}
(A) 1 2 3 4 5 6 ...................infinite
(B) 1 2 3 4 5 5 ...................infinite
(C) 1 2 3 4 4 4 ...................infinite
(D) 1 2 3 4 4 3 ...................infinite
Ques 10 :
What is the output of following program?
void main(){
int a;
a=~0;
printf("%d",a);
}
(A) 0
(B) 1
(C) -1
(D) none of these
Ques 11 :
What will be output when you will execute following code?
void main(){
int a;
a=5;
if(a=15)
printf("welcome%d",a);
else
printf("hello%d"a);
}
(A) welcome 5
(B) welcome 15
(C) hello 5
(D) hello 15
Ques 12 :
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 13 :
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 14 :
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 15 :
What is the output of following program?
void main(){
int a=2;
switch(a)
{
case 4: printf("A");
break;
case 3: printf("B");
case default : printf("C");
case 1 : printf("D");
break;
case 5 : printf("E");
}
}
(A) C
(B) C D
(C) E
(D) error
Ques 16 :
What will be printed as the result of the operation below:
main()
{
int x=10, y=15;
x = x++;
y = ++y;
printf("%d %d",x,y);
}
(A) 10, 16
(B) 11, 16
(C) 10, 16
(D) 11, 15
Ques 17 :
What will be printed as the result of the operation below:
int x;
int modifyvalue()
{
return(x+=10);
}
int changevalue(int x)
{
return(x+=1);
}
void main()
{
int x=10;
x++;
changevalue(x);
x++;
modifyvalue();
printf("First output:%dn",x);
x++;
changevalue(x);
printf("Second output:%dn",x);
modifyvalue();
printf("Third output:%dn",x);
}
(A) 12, 12, 12
(B) 12, 12, 13
(C) 12, 13, 13
(D) 13, 13, 13
Ques 18 :
what is the output of following program?
main(){
int a,b;
a=b=100;
scanf("%d%d",a,&b);
//Entered Values are 40 85
printf("%d %d",a,b);
}
(A) 40 85
(B) 0 85
(C) 100 85
(D) 100 100
Ques 19 :
What will be output when you will execute following code?
#include<stdio.h>
int main(){
char arr[11]="The African Queen";
printf("%s",arr);
return 0;
}
Choose all that
(A)
(B)
(C) The African
(D) Compilation
(A) The
(B) The African
(C) Compilation
(D) None of the
Ques 20 :
what is the output of following program?
void main(){
int a;
a=10;
a*=10+2;
printf("%d",a);
}
(A) 102
(B) 100
(C) 120
(D) 22
Submit Answer
Don't Refresh the Page !! ...