মঙ্গলবার, ৯ জুন, ২০১৫

Test 2: C - Data Types

1
What will be output when you will execute following c code?
#include<stdio.h>
int main(){
volatile int a=11;
printf("%d",a);
return 0;
}
Choose all that apply:
[1 marks]
A 11
B Garbage
C -2
D We cannot predict
E Compilation error
2
What is the range of signed int data type in that compiler in which size of int is two byte?
[1 marks]
A -255 to 255
B -32767 to 32767
C -32768 to 32768
D -32767 to 32768
E -32768 to 32767
3
What will be output when you will execute following c code?
#include<stdio.h>
const enum Alpha{
X,
Y=5
Z
}P=10;
int main(){
enum Alpha a,b;
a= X;
b= Z;
printf("%d",a+b-p);
return 0;
}
Choose all that apply:
[1 marks]
A -4
B -5
C 10
D 11
E Error: Cannot modify constant object
4
What will be output when you will execute following c code?
#include<stdio.h>
int main(){
char a=250;
int expr;
expr= a+ !a +  ~a + ++a;
printf("%d",expr);
return 0;
}
Choose all that apply:
[1 marks]
A 249
B 250
C 0
D -6
E Compilation Error
5
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;
[1 marks]
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
6
What will be output when you will execute following c code?

#include<stdio.h>
int main(){
int a=-5;
unsigned int b=-5u;
if(a==b)
printf(“Avatar");
else
printf("Alien");
return 0;
}
Choose all that apply:
[1 marks]
A Avatar
B Alien
C Run time error
D Error: Illegal assignment
E Error: Don’t compare signed no. with unsigned no.
7
What will be output when you execute following c code?

#include<stdio.h>
extern enum cricket x;
int main(){
printf("%d",x);
return 0;
}
const enum cricket{
Taylor,
Kallis=17,
Chanderpaul
}x= Taylor|Kallis&Chanderpaul;

Choose all that apply:
[1 marks]
A 0
B 15
C 16
D 17
E Compilation Error
8
Which of the following is not derived data type in c?
[1 marks]
A Function
B Pointer
C Enumeration
D Array
E All are derived data type
9
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;
int main(){
printf("%d %d",x,varp.q);
return 0;
}
Choose all that apply:
[1 marks]
A 0 11
B 5 10
C 4 11
D 0 10
E Compilation Error
10
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:
[1 marks]
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


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.

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

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