0% found this document useful (0 votes)
21 views3 pages

Question Set6 - C

The document contains several C code snippets and questions about C programming concepts. It covers topics like data types, operators, type modifiers, and more. Multiple choice questions are provided to test understanding of C fundamentals.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views3 pages

Question Set6 - C

The document contains several C code snippets and questions about C programming concepts. It covers topics like data types, operators, type modifiers, and more. Multiple choice questions are provided to test understanding of C fundamentals.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Question Set: 6

By Rabi Shaw P.No:9007960872


5. What will be output ?
#include<stdio.h>
Datatype: int main(){
1 . What will be output ? double num=5.2;
#include<stdio.h> int var=5;
int main(){ printf("%d\t",sizeof(!num));
printf("%d\t",sizeof(6.5)); printf("%d\t",sizeof(var=15/2));
printf("%d\t",sizeof(90000)); printf("%d",var);
printf("%d",sizeof('A')); return 0;
return 0; }
} 1) A) 2 2 5 b) 4 4 5 c) 2 1 5 d) 2
A) 4 2 1 b) 8 2 1 c) 4 4 1 d) 8 4 1 e) 8 4 2 4 7 e) 8 2 7
2. Consider on following declaring of
enum.
6. What will be output ?
(i) enum cricket #include<stdio.h>
{Gambhir,Smith,Sehwag}c; int main(){
(ii) enum cricket const int *p;
{Gambhir,Smith,Sehwag}; int a=10;
(iii) enum {Gambhir,Smith=- p=&a;
5,Sehwag}c; printf("%d",*p);
(iv) enum c {Gambhir,Smith,Sehwag}; return 0;
A) Only (i) is correct declaration }
B) Only (i) and (ii) is correct a) 0 b)10 c) Garbage value d) Any
declaration memory address e) Error: Can not
modify const object
C) Only (i) and (iii) are correct
declaration 7. Consider on following declaration:
D) Only (i),(ii) and are correct (i) short i=10; (ii) static i=10;
declaration (iii) unsigned i=10; (iv) const
E) All four are correct declaration i=10;
Choose correct one:
3. What will be output ? A) Only (iv) is incorrect b) Only
#include<stdio.h> (ii) and (iv) are incorrect c) Only
int main(){ (ii),(iii) and (iv) are correct d)
signed x; Only (iii) is correct e) All are
unsigned y; correct declaration
x = 10 +- 10u + 10u +- 10; 8. What will be output ?
y = x; #include<stdio.h>
if(x==y) int main(){
printf("%d %d",x,y); int a= sizeof(signed)
else if(x!=y) +sizeof(unsigned);
printf("%u %u",x,y); int
return 0; b=sizeof(const)+sizeof(volatile);
} printf("%d",a+++b);
1) A) 0 0 B) 65536 -10 c) 0 65536 return 0;
d) 65536 0 e) Compilation error }
4. Which of the following is not 1) A) 10 b) 9 c) 8 d)
modifier of data type in c? Error: Cannot find size of
modifiers e) Error: Undefined
1) A) Extern b) Interrupt c) operator +++
Huge d) Register e) All of
these are modifiers of data type
9. What will be output ?
#include<stdio.h> int main(){
int main(){ char a=250;
signed x,a; int expr;
unsigned y,b; expr= a+ !a + ~a + ++a;
a=(signed)10u; printf("%d",expr);
b=(unsigned)-10; return 0;
y = (signed)10u + (unsigned)-10; }
x = y; 15. Consider on order of modifiers in
printf("%d %u\t",a,b); following declaration:
if(x==y)
printf("%d %d",x,y); (i)char volatile register unsigned c;
else if(x!=y) (ii)volatile register unsigned char c;
printf("%u %u",x,y); (iii)register volatile unsigned char c;
return 0; (iv)unsigned char volatile register c;
}
1) A) 10 -10 0 0 b) 10 -10 16. What will be output ?
65516 -10 c) 10 -10 10 -10 d) #include<stdio.h>
10 65526 0 0 e) Compilation int main(){
error int a=-5;
unsigned int b=-5u;
10. Which of the following is if(a==b)
integral data type? printf("Avatar");
a) Void else
b) Char printf("Alien");
c) Float return 0;
d) Double }
e) Non of these 17. What will be output ?
#include<stdio.h>
12. What is the range of signed int extern enum cricket x;
data type in that compiler in which int main(){
size of int is two byte? printf("%d",x);
a) -255 to 255 return 0;
b) -32767 to 32767 }
c) -32768 to 32768 const enum cricket{
d) -32767 to 32768 Taylor,
e) -32768 to 32767 Kallis=17,
Chanderpaul
13. What will be output ? }x=Taylor|Kallis&Chanderpaul;
#include<stdio.h>
const enum Alpha{ 18. Which of the following is not
X, derived data type in c?
Y=5, a) Function
Z b) Pointer
}p=10; c) Enumeration
int main(){ d) Array
enum Alpha a,b; e) All are derived data type
a= X;
b= Z; 19. What will be output ?
printf("%d",a+b-p); #include<stdio.h>
return 0; enum A{
} x,y=5,
enum B{
p=10,q
}varp;
14. What will be output ? }varx;
#include<stdio.h>
int main(){ 6. #include<stdio.h>
printf("%d %d",x,varp.q); int main(){
return 0; int a=0,b=10;
} if(a=0){
20. Consider on following declaration printf("true"); }
in c: else{
printf("false"); }
(i)short const register i=10; }
(ii)static volatile const int i=10;
(iii)unsigned auto long register i=10; 7. #include<stdio.h>
(iv)signed extern float i=10.0; int main(){
int a;
Choose correct one: a=015 + 0x71 +5;
a) Only (iv)is correct printf("%d",a); }
b) Only (ii) and (iv) is correct
c) Only (i) and (ii) is correct 8.#include<stdio.h>
d) Only (iii) correct int main(){
e) All are correct declaration printf("%d %d %d", sizeof(3.14)
,sizeof(3.14f), sizeof(3.14L));
Operators: }

(9)#include<stdio.h>
What will be output of the following
int main(){
program?
int x=100,y=20,z=5;
(1)#include<stdio.h>
printf("%d %d %d"); }
int main(){
float a=0.7;d
(10)#include<stdio.h>
if(a<0.7){
printf("C"); } int main(){
int a=2;
else{
a=a++ + ~++a;
printf("C++"); }
printf("%d",a); }
}
2. #include<stdio.h>
(11)#include<stdio.h>
int main(){
int main(){
int i=5,j;
int a;
j=++i+++i+++i;
a=sizeof(!5.6);
printf("%d %d",i,j);
printf("%d",a); }
}
3. #include<stdio.h>
(12)#include<stdio.h>
int main(){
int main(){
int i=1;
float a;
i=2+2*i++;
(int)a= 45;
printf("%d",i);
printf("%d”,a);}
}
13.#include<stdio.h>
(4)#include<stdio.h>
int main(){
int main(){
int i=5;
int a=2,b=7,c=10;
int a=++i + ++i + ++i;
c=a==b;
printf("%d",a);
printf("%d",c);
}
}
(5)#include<stdio.h>
void main(){
int x;
x=10,20,30;
printf("%d",x); }

You might also like