1.
What will be output when you will execute following c code?
#include<stdio.h>
void main(){
printf("%d\t",sizeof(6.5));
printf("%d\t",sizeof(90000));
printf("%d",sizeof('A'));
}
Choose all that apply:
(A) 4 2 1
(B) 8 2 1
(C) 4 4 1
(D) 8 4 1
(E) 8 4 2
Explanation: D
2.
Consider on following declaring of enum.
(i) enum cricket {Gambhir,Smith,Sehwag}c;
(ii) enum cricket {Gambhir,Smith,Sehwag};
(iii) enum {Gambhir,Smith=-5,Sehwag}c;
(iv) enum c {Gambhir,Smith,Sehwag};
Choose correct one:
(A)Only (i) is correct declaration
(B) Only (i) and (ii) is correct declaration
(C) Only (i) and (iii) are correct declaration
(D) Only (i),(ii) and are correct declaration
(E) All four are correct declaration
Explanation: E
3.
What will be output when you will execute following c code?
#include<stdio.h>
void main(){
signed x;
unsigned y;
x = 10 +- 10u + 10u +- 10;
y = x;
if(x==y)
printf("%d %d",x,y);
else if(x!=y)
printf("%u %u",x,y);
}
Choose all that apply:
(A) 0 0
(B) 65536 -10
(C) 0 65536
(D) 65536 0
(E) Compilation error
Explanation:A
4.
Which of the following is not modifier of data type in c?
(A) extern
(B) interrupt
(C) huge
(D) register
(E) All of these are modifiers of data type
Explanation:E
5.
What will be output when you will execute following c code?
#include<stdio.h>
void main(){
double num=5.2;
int var=5;
printf("%d\t",sizeof(!num));
printf("%d\t",sizeof(var=15/2));
printf("%d",var);
}
Choose all that apply:
(A) 4 2 7
(B) 4 4 5
(C) 2 2 5
(D) 2 4 7
(E) 8 2 7
Explanation: C
6.
What will be output when you will execute following c code?
#include<stdio.h>
void main(){
const int *p;
int a=10;
p=&a;
printf("%d",*p);
}
Choose all that apply:
(A) 0
(B) 10
(C) Garbage value
(D) Any memory address
(E) Error: Cannot modify const object
Explanation: B
7.
Consider on following declaration:
(i) short i=10;
(ii) static i=10;
(iii) unsigned i=10;
(iv) const i=10;
Choose correct one:
(A)Only (iv) is incorrect
(B) Only (ii) and (iv) are incorrect
(C) Only (ii),(iii) and (iv) are correct
(D) Only (iii) is correct
(E) All are correct declaration
Explanation: E
8.
What will be output when you will execute following c code?
#include<stdio.h>
void main(){
int a= sizeof(signed) +sizeof(unsigned);
int b=sizeof(const)+sizeof(volatile);
printf("%d",a+++b);
}
Choose all that apply:
(A) 10
(B) 9
(C) 8
(D) Error: Cannot find size of modifiers
(E) Error: Undefined operator +++
Explanation: C
9.
What will be output when you will execute following c code?
#include<stdio.h>
void 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);
}
Choose all that apply:
(A) 10 -10 0 0
(B) 10 -10 65516 -10
(C) 10 -10 10 -10
(D) 10 65526 0 0
(E) Compilation error
Explanation: D
10.
Which of the following is integral data type?
(A) void
(B) char
(C) float
(D) double
(E) None of these
Explanation: B
11.
What will be output when you will execute following c code?
#include<stdio.h>
void main(){
volatile int a=11;
printf("%d",a);
}
Choose all that apply:
(A) 11
(B) Garbage
(C) -2
(D) We cannot predict
(E) Compilation error
Explanation: D
12.
What is the range of signed int data type in that compiler in which size of int is two byte?
(A) -255 to 255
(B) -32767 to 32767
(C) -32768 to 32768
(D) -32767 to 32768
(E) -32768 to 32767
Explanation: E
13.
What will be output when you will execute following c code?
#include<stdio.h>
const enum Alpha{
X,
Y=5,
Z
}p=10;
void main(){
enum Alpha a,b;
a= X;
b= Z;
printf("%d",a+b-p);
}
Choose all that apply:
(A) -4
(B) -5
(C) 10
(D) 11
(E) Error: Cannot modify constant object
Explanation: A
14.
What will be output when you will execute following c code?
#include<stdio.h>
void main(){
char a=250;
int expr;
expr= a+ !a + ~a + ++a;
printf("%d",expr);
}
Choose all that apply:
(A) 249
(B) 250
(C) 0
(D) -6
(E) Compilation error
Explanation: D
15.
Consider on order of modifiers in following declaration:
(i)char volatile register unsigned c;
(ii)volatile register unsigned char c;
(iii)register volatile unsigned char c;
(iv)unsigned char volatile register c;
Choose correct one:
(A) Only (ii) is correct declaration
(B) Only (i) is correction declaration
(C) All are incorrect
(D) All are correct but they are different
(E) All are correct and same
Explanation: E
16.
What will be output when you will execute following c code?
#include<stdio.h>
void main(){
int a=-5;
unsigned int b=-5u;
if(a==b)
printf("Avatar");
else
printf("Alien");
}
Choose all that apply:
(A) Avatar
(B) Alien
(C) Run time error
(D) Error: Illegal assignment
(E) Error: Don’t compare signed no. with unsigned no.
Explanation: A
17.
What will be output when you will execute following c code?
#include<stdio.h>
extern enum cricket x;
void main(){
printf("%d",x);
}
const enum cricket{
Taylor,
Kallis=17,
Chanderpaul
}x=Taylor|Kallis&Chanderpaul;
Choose all that apply:
(A) 0
(B) 15
(C) 16
(D) 17
(E) Compilation error
Explanation: C
18.
Which of the following is not derived data type in c?
(A) Function
(B) Pointer
(C) Enumeration
(D) Array
(E) All are derived data type
Explanation: C
19.
What will be output when you will execute following c code?
#include<stdio.h>
enum A{
x,y=5,
enum B{
p=10,q
}varp;
}varx;
void main(){
printf("%d %d",x,varp.q);
}
Choose all that apply:
(A) 0 11
(B) 5 10
(C) 4 11
(D) 0 10
(E) Compilation error
Explanation: E
20.
Consider on following declaration in c:
(i)short const register i=10;
(ii)static volatile const int i=10;
(iii)unsigned auto long register i=10;
(iv)signed extern float i=10.0;
Choose correct one:
(A) Only (iv)is correct
(B) Only (ii) and (iv) is correct
(C) Only (i) and (ii) is correct
(D) Only (iii) correct
(E) All are correct declaration
Explanation: C
can u post the explanations
ReplyDelete