রবিবার, ৭ জুন, ২০১৫

Test 1: C - Data Types


 
1
What will be output when you will execute following c code?
#include<stdio.h>
int main(){
printf("%d\t",sizeof(6.5));
printf("%d\t",sizeof(90000));
printf(“%d”,sizeof(‘A’));
return 0; }
Choose all that apply:
[1 marks]
A 4 2 1
B 8 2 1
C 4 4 1
D 8 4 1
E 8 4 2
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:
[1 marks]
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
3
What will be output when you will execute following c code?
#include<stdio.h>
int 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);}
return 0; }
Choose all that apply:
[1 marks]
A 0 0
B 65536 -10
C 0 65536
D 65536 0
E Compilation error
4
Which of the following is not modifier of data type in c?
                [1 marks]
A extern
B interrupt
C huge
D register
E All of these are modifiers of data type
5
What will be output when you will execute following c code?
#include<stdio.h>
int main(){
double num=5.2;
int var=5;
printf("%d\t",sizeof(!num));
printf("%d\t";sizeof(var=15/2));
printf("%d",var);
return 0; }
Choose all that apply:
[1 marks]
A 4 2 7
B 4 4 5
C 2 2 5
D 2 4 7
E 8 2 7
6
What will be output when you will execute following c code?
#include<stdio.h>
int main(){
const int *p;
int a=10;
p=&a;
printf("%d",*p);
return 0; }
Choose all that apply:
[1 marks]
A 0
B 10
C Garbage value
D Any memory address
E Error: Cannot modify const object
7
Consider on following declaration:
(i)            short i=10;
(ii)           static i=10;
(iii)          unsigned i=10;
(iv)         const i=10;
Choose correct one:
[1 marks]
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
8
What will be output when you will execute following c code?
#include<stdio.h>
int main(){
int a= sizeof(signed) + sizeof(unsigned);
int b= sizeof(const) + sizeof(volatile);
printf("%d",a+++b);
return 0; }
Choose all that apply:
[1 marks]
A 10
B 9
C 8
D Error: Cannot find sixe of modifiers
E Error: Undefined operator +++
9
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; }
 
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
10
Which of the following is integral data type?
[1 marks]
A void
B char
C float
D double
E None of these

 
The answers will not be published here. You need to contact me to collect the answers and the description of the answers. Mail me, IM me or you can even call me for answers if you want.

For more query please contact me on Facebook.
Mail me on Gmail.
Watch my YouTube videos for IT solutions.
And don't forget to leave a comment.

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন