C Language
C Language
com
B. basc
C. Bas94c
D. none of these
Answer: B
4. What will be the output of the following
statements ?
int a = 4, b = 7,c; c = a = = b; printf(“%i”,C.;
A. 0
B. error
C. 1
D. garbage value
Answer: A
5. What will be the output of the following
statements ?
int a = 5, b = 2, c = 10, i = a>b
void main()
{ printf(“hello”); main(); }
A. 1
B. 2
C. infinite number of times
D. none of these
Answer: C
©www.Himexam.com
C. 032
D. 321
Answer: C
8. What will be the output of the following
statement ?
printf( 3 + “goodbye”);
A. goodbye
B. odbye
C. bye
D. dbye
Answer: D
9. What will be the output of the following
statements ?
long int a = scanf(“%ld%ld”,&a,&A.;
printf(“%ld”,A.;
A. error
B. garbage value
C. 0
D. 2
Answer: B
10. What will be the output of the following
program ?
#include
©www.Himexam.com
void main()
{ int a = 2;
switchA.
{ case 1:
printf(“goodbye”); break;
case 2:
continue;
case 3:
printf(“bye”);
}
}
A. error
B. goodbye
C. bye
D. byegoodbye
Answer: A
11. What will be the output of the following
statements ?
int i = 1,j; j=i— -2; printf(“%d”,j);
A. error
B. 2
C. 3
©www.Himexam.com
D. -3
Answer: C
12. What will be the output of following
program ?
#include
main()
{
int x,y = 10;
x = y * NULL;
printf(“%d”,x);
}
A. error
B. 0
C. 10
D. garbage value
Answer: B
13. What will be the output of following
statements ?
char x[ ] = “hello hi”;
printf(“%d%d”,sizeof(*x),sizeof(x));
A. 88
B. 18
C. 29
©www.Himexam.com
D. 19
Answer: D
14. What will be the output of the following
statements ?
int a=5,b=6,c=9,d; d=(ac?1:2):(c>b?6:8));
printf(“%d”,D.;
A. 1
B. 2
C. 6
D. Error
Answer: D
15. What will be the output of the following
statements ?
int i = 3;
printf(“%d%d”,i,i++);
A. 34
B. 43
C. 44
D. 33
Answer: B
16. What will be the output of the following
program ?
#include
©www.Himexam.com
void main()
{
int a = 36, b = 9;
printf(“%d”,a>>a/b-2);
}
A. 9
B. 7
C. 5
D. none of these
Answer: A
17. int testarray[3][2][2] = {1, 2, 3, 4, 5, 6, 7,
8, 9, 10, 11, 12};
What value does testarray[2][1][0] in the
sample code above contain?
A. 11
B. 7
C. 5
D. 9
Answer: A
18. void main()
{
int a=10,b=20;
char x=1,y=0;
©www.Himexam.com
if(a,b,x,y)
{
printf(“EXAM”);
}
}
What is the output?
A. XAM is printed
B. exam is printed
C. Compiler Error
D. Nothing is printed
Answer: D
19. What is the output of the following
code?
#include
void main()
{
int s=0;
while(s++<10)>
# define a 10
main()
{
printf(“%d..”,A.;
foo();
©www.Himexam.com
printf(“%d”,A.;
}
void foo()
{
#undef a
#define a 50
}
A. 10..10
B. 10..50
C. Error
D. 0
Answer: C
20. main()
{
struct
{
int i;
}xyz;
(*xyz)->i=10;
printf(“%d”,xyz.i);
}
What is the output of this program?
A. program will not compile
©www.Himexam.com
B. 10
C. god only knows
D. address of I
Answer: B
21.What will happen if in a C program you
assign a value to an array element whose
subscript exceeds the size of array?
A. The element will be set to 0.
B. The compiler would report an error.
C. The program may crash if some important
data gets overwritten.
D. The array size would appropriately grow.
Answer: C
22. What would be the output of the
following program?
#include
main()
{
char str[]=”S\065AB”;
printf(“n%d”, sizeof(str));
}
A. 7
B. 6
©www.Himexam.com
C. 5
D. error
Answer: B
23. What will be the value of `a` after the
following code is executed
#define square(x) x*x
a = square(2+3)
A. 25
B. 13
C. 11
D. 10
Answer: C
24. #include
void func()
{
int x = 0;
static int y = 0;
x++; y++;
printf( “%d — %dn”, x, y );
}
int main()
{
func();
©www.Himexam.com
func();
return 0;
}
What will the code above print when it is
executed?
A.
1—1
1—1
B.
1—1
2—1
C.
1—1
2—2
D.
1—1
1—2
Answer: D
25. long factorial (long x)
{
????
return x * factorial(x – 1);
}
©www.Himexam.com
if ( i == 8)
{
i++;
if (i == 9) break;
i *= 2;
}
i -= 4;
break;
case 8:
i += 5;
break;
}
printf(“i = %dn”, i);
What will the output of the sample code
above be?
A. i = 5
B. i = 8
C. i = 9
D. i = 10
Answer: A
28. What will be output if you will compile
and execute the following c code?
void main()
©www.Himexam.com
{
if(printf(“cquestionbank”))
printf(“I know c”);
else
printf(“I know c++”);
}
A. I know c
B. I know c++
C. cquestionbankI know c
D. cquestionbankI know c++
(e) Compiler error
Answer: C
29.What will be output if you will compile
and execute the following c code?
#define call(x) #x
void main(){
printf(“%s”,call(c/c++));
}
A.c
B.c++
C.#c/c++
D.c/c++
©www.Himexam.com
(e)Compiler error
Answer: D
30. What will be output if you will compile
and execute the following c code?
#define message “union is
power of c”
void main()
{
clrscr();
printf(“%s”,message);
getch();
}
A. union is power of c
B. union is power of c
C. union is Power of c
D. Compiler error
(e) None of these
Answer: B
31. What will be output if you will compile
and execute the following c code?
void main(){
int a=25;
clrscr();
©www.Himexam.com
printf(“%o %x”,a,A.;
getch();
}
A. 25 25
B. 025 0x25
C. 12 42
D. 31 19
(e) None of these
Answer: D
32. What will be output if you will compile
and execute the following c code?
void main()
{
int i=0;
if(i==0){
i=((5,(i=3)),i=1);
printf(“%d”,i);
}
else
printf(“equal”);
}
A. 5
B. 3
©www.Himexam.com
C. 1
D. equal
(e) None of above
Answer: C
33.What will be output if you will compile
and execute the following c code?
int extern x;
void main()
printf(“%d”,x);
x=2;
getch();
}
int x=23;
A. 0
B. 2
C. 23
D. Compiler error
(e) None of these
Answer: C
34.What will be output if you will compile
and execute the following c code?
void main(){
int a,b;
©www.Himexam.com
a=1,3,15;
b=(2,4,6);
clrscr();
printf(“%d “,a+B.;
getch();
}
A. 3
B. 21
C. 17
D. 7
(e) Compiler error
Answer: D
35.What will be output if you will compile
and execute the following c code?
void main(){
static main;
int x;
x=call(main);
clrscr();
printf(“%d “,x);
getch();
}
int call(int address){
©www.Himexam.com
address++;
return address;
}
A. 0
B. 1
C. Garbage value
D. Compiler error
(e) None of these
Answer: B
36. What will be output if you will compile
and execute the following c code?
#include “string.h”
void main(){
clrscr();
printf(“%d
%d”,sizeof(“string”),strlen(“string”));
getch();
}
A. 6 6
B. 7 7
C. 6 7
D. 7 6
(e) None of these
©www.Himexam.com
Answer: D
delay(250);
int86(0x33,&i,&o);
}
getch();
}
38.What will be output if you will compile
and execute the following c code?
void main(){
int huge*p=(int huge*)0XC0563331;
int huge*q=(int huge*)0xC2551341;
*p=200;
printf(“%d”,*q);
}
A.0
B.Garbage value
C.null
D. 200
E. Compiler error
Answer: D
struct marks{
int p:3;
int c:3;
int m:2;
};
void main(){
struct marks s={2,-6,5};
printf(“%d %d %d”,s.p,s.c,s.m);
}
A. 2 -6 5
B. 2 -6 1
C. 2 2 1
D. Compiler error
(e) None of these
Answer: C
}
A. I know c
B. I know c++
C. cquestionbankI know c
D. cquestionbankI know c++
(e) Compiler error
Answer: C
41.What will be output if you will compile
and execute the following c code?
#define call(x) #x
void main(){
printf(“%s”,call(c/c++));
}
A.c
B.c++
C.#c/c++
D.c/c++
(e)Compiler error
Answer: D
42. What will be output if you will compile
and execute the following c code?
#define message “union is
power of c”
©www.Himexam.com
void main(){
clrscr();
printf(“%s”,message);
getch();
}
A. union is power of c
B. union ispower of c
C. union is
Power of c
D. Compiler error
(e) None of these
Answer: B
43. What will be output if you will compile
and execute the following c code?
void main(){
int a=25;
clrscr();
printf(“%o %x”,a,A.;
getch();
}
A. 25 25
B. 025 0x25
C. 12 42
©www.Himexam.com
D. 31 19
(e) None of these
Answer: D
44. What will be output if you will compile
and execute the following c code?
void main(){
int i=0;
if(i==0){
i=((5,(i=3)),i=1);
printf(“%d”,i);
}
else
printf(“equal”);
}
A. 5
B. 3
C. 1
D. equal
(e) None of above
Answer: C
45.What will be output if you will compile
and execute the following c code?
int extern x;
©www.Himexam.com
void main()
printf(“%d”,x);
x=2;
getch();
}
int x=23;
A. 0
B. 2
C. 23
D. Compiler error
E. None of these
Answer: C
46.What will be output if you will compile
and execute the following c code?
void main(){
int a,b;
a=1,3,15;
b=(2,4,6);
clrscr();
printf(“%d “,a+B.;
getch();
}
A. 3
©www.Himexam.com
B. 21
C. 17
D. 7
E. Compiler error
Answer: D
47.What will be output if you will compile
and execute the following c code?
void main(){
static main;
int x;
x=call(main);
clrscr();
printf(“%d “,x);
getch();
}
int call(int address){
address++;
return address;
}
A. 0
B. 1
C. Garbage value
D. Compiler error
©www.Himexam.com
E. None of these
Answer: B
48.What will be output if you will compile
and execute the following c code?
#include “string.h”
void main(){
clrscr();
printf(“%d
%d”,sizeof(“string”),strlen(“string”));
getch();
}
A. 6 6
B. 7 7
C. 6 7
D. 7 6
(e) None of these
Answer: D
49.What will be output if you will compile
and execute the following c code?
void main(){
int huge*p=(int huge*)0XC0563331;
int huge*q=(int huge*)0xC2551341;
*p=200;
©www.Himexam.com
printf(“%d”,*q);
}
A.0
B.Garbage value
C.null
D. 200
(e)Compiler error
Answer: D
50.What will be output if you will compile
and execute the following c code?
struct marks{
int p:3;
int c:3;
int m:2;
};
void main(){
struct marks s={2,-6,5};
printf(“%d %d %d”,s.p,s.c,s.m);
}
A. 2 -6 5
B. 2 -6 1
C. 2 2 1
D. Compiler error
©www.Himexam.com
}
A.c
B.c++
C.#c/c++
D.c/c++
E. Compiler error
Answer: D
53. What will be output if you will compile
and execute the following c code?
#define message “union is
power of c”
void main(){
clrscr();
printf(“%s”,message);
getch();
}
A. union is power of c
B. union ispower of c
C. union is
Power of c
D. Compiler error
E. None of these
Answer: B
©www.Himexam.com
printf(“equal”);
}
A. 5
B. 3
C. 1
D. equal
E. None of above
Answer: C
56.What will be output if you will compile
and execute the following c code?
int extern x;
void main()
printf(“%d”,x);
x=2;
getch();
}
int x=23;
A. 0
B. 2
C. 23
D. Compiler error
(e) None of these
Answer: C
©www.Himexam.com
printf(“%d “,x);
getch();
}
int call(int address){
address++;
return address;
}
A. 0
B. 1
C. Garbage value
D. Compiler error
(e) None of these
Answer: B
59.What will be output if you will compile
and execute the following c code?
#include “string.h”
void main(){
clrscr();
printf(“%d
%d”,sizeof(“string”),strlen(“string”));
getch();
}
A. 6 6
©www.Himexam.com
B. 7 7
C. 6 7
D. 7 6
(e) None of these
Answer: D.
60.What will be output if you will compile
and execute the following c code?
void main(){
int huge*p=(int huge*)0XC0563331;
int huge*q=(int huge*)0xC2551341;
*p=200;
printf(“%d”,*q);
}
A.0
B.Garbage value
C.null
D. 200
(e)Compiler error
Answer: D.
61. Who is father of C Language?
A. Bjarne Stroustrup
B. Dennis Ritchie
C. James A. Gosling
©www.Himexam.com
D. A & B Both
Answer: D
75. What is Keywords?
A. Keywords have some predefine meanings
and these meanings can be changed.
B. Keywords have some unknown meanings
and these meanings cannot be changed.
C. Keywords have some predefine meanings
and these meanings cannot be changed.
D. None of the above
Answer: C
76. What is constant?
A. Constants have fixed values that do not
change during the execution of a program
B. Constants have fixed values that change
during the execution of a program
C. Constants have unknown values that may
be change during the execution of a program
D. None of the above
Answer: A
77. Which is the right way to declare
constant in C?
A. int constant var =10;
©www.Himexam.com
C. FILO
D. FIFO
Answer: D
87. The statement print f (“%d”, 10 ? 0 ? 5 : 1
: 12); will print?
A. 10
B. 0
C. 12
D. 1
Answer: D
88. To represent hierarchical relationship
between elements, which data structure is
suitable?
A. Priority
B. Tree
C. Dqueue
D. All of the above
Answer: B
89. Which of the following data structure is
linear type?
A. Strings
B. Queue
C. Lists
©www.Himexam.com