(1) What is the output of below program:
For(char i = 0; i<256; i++)
Printf(“%d\n”,i);
Modify above program so that it can prints number from 0 to 255.
(2) 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
(3) What will be output when you will execute following c code?
#include
int main(){
printf("%d\t",sizeof(6.5));
printf("%d\t",sizeof(90000));
printf("%d",sizeof('A')); return 0;
}
Choose all that apply:
(A) 4 2 1
(B) 8 2 1
(C) 4 4 1
(D) 8 4 1
(E) 8 4 2
(4) What will be output when you will execute following c code?
#include
int main(){
int a= sizeof(signed) +sizeof(unsigned);
int b=sizeof(const)+sizeof(volatile);
printf("%d",a+++b); return 0;
}
Choose all that apply:
(A) 10
(B) 9
(C) 8
(D) Error: Cannot find size of modifiers
(E) Error: Undefined operator +++
(5) What will be output when you will execute following c code?
#include
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
(6) 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
(7) Which of the following data type is right in C programming?
A. Long long double
B. Unsigned long long int
C. Long double int
D. Unsigned long double
(8) Solve the Following:
#include
int main()
{
char num = '\010';
printf("%d", num);
return 0;
}
A. 010
B. 08
C. 10
D. 8
(9) Solve the Following:
#include
int main()
{
void num=10;
printf("%v", num);
return 0;
}
A. Compilation error
B. 10
C. Garbage value
D. 0
(10) Solve the Following:
#include
int main()
{
extern int num;
num = 5;
printf("%d", num);
return 0;
}
A. Compilation Error
B. Linker error
C. Runtime error
D. 5