You are on page 1of 14

Q 1 - What is the output of the following code snippet?

#include<stdio.h>

main()

int const a = 5;

a++;

printf(“%d”,a);

A-5

B-6

C - Runtime error

D - Compile error

Answer : D
Q 2 - What is the output of the following program?

#include<stdio.h>

main()

int i = 1;

while( i++<=5 )

printf("%d ",i++);

A-135
B-24

C-246

D-2

Answer : C
Q 3 - What is the output of the following program?

#include<stdio.h>

main()

int a[] = {2,1};

printf("%d", *a);

A-0

B-1

C-2

D - Compile error.

Answer : C
Q 4 - Choose the correct option in respect to the following program.

#include<stdio.h>

void f(int const i)

i=5;

main()

{
int x = 10;

f(x);

 I - Error in the statement ‘void f(int const i)’

 II - Error in the statement i=5.

A - Statements I & II are true

B - Statements I & II are false.

C - Statement I is true

D - Statement II is true.

Answer : D
Q 5 - Similarity between a structure, union and enumeration,

A - All are helpful in defining new variables

B - All are helpful in defining new data types

C - All are helpful in defining new pointers

D - All are helpful in defining new structures

Answer : B
Q 6 - To print a double value which format specifier can be used?

A - %L

B - %lf

C - %Lf

D - None of the above

Answer : B
Q 7 - What is the output of the following code snippet?

#include<stdio.h>
main()

int const a = 5;

a++;

printf(“%d”,a);

A-5

B-6

C - Runtime error

D - Compile error

Answer : D
Question: 8
How many main() function we can have in our project?

(A) 1
(B) 2
(C) No Limit
(D) Depends on Compiler
Ans: A

Question: 9
What is sizeof() in C?

(A) Operator
(B) Function
(C) Macro
(D) None of these

Ans: A

Question: 10
int main()

extern int i;

i = 20;

printf("%d", sizeof(i));

return 0;

(A) 20
(B) 0
(C) Undefined reference to i
(D) Linking Error

Ans: C

Question: 11
Is the following statement a declaration or definition

extern int i;

(A) Declaration
(B) Definition

Ans: A

Question: 12
main()

int x = 10;

int x = 0;

printf("%d",x);

}
}

(A) 10
(B) Compilation Error
(C) 0
(D) Undefined

Ans: C

Question: 13
int x = 10;

int main()

int x = 0;

printf("%d",x);

return 0;

(A) 10
(B) 0
(C) Compilation Error
(D) Undefined

Ans: B

Question: 14
//This question is compiled on 32 bit DEV-C++

int main()

char *ptr1, *ptr2;


printf("%d %d", sizeof(ptr1), sizeof(ptr2));

return 0;

(A) 1 1
(B) 2 2
(C) 4 4
(D) Undefined

Ans: C

Question: 15
Which programming language is more faster among these?

(A) Java
(B) Php
(C) C
(D) Visual Basix

Ans: C

Question: 16
What should be the output:

void main()

int a = 10/3;

printf("%d",a);

(A) 3.33
(B) 3.0
(C) 3
(D) 0
Ans: C

Question: 17
Which of the following is executed by Preprocess?

(A) #include<stdio.h>
(B) return 0
(C) void main(int argc , char ** argv)
(D) None of above

Ans: A

Question: 18
void main()

int a = 10.5;

printf("%d",a);

(A) 10.5
(B) 10
(C) 0
(D) Compilation Error

Ans: B

Question: 19

int main()

int x;

x=10,20,30;
printf("%d",x);

return 0;

}
(A) 10
(B) 20
(C) 30
(D) Compilation Error

Ans: A

Question: 20

How many times CppBuzz.com is printed?

void main()

int a = 0;

while(a++ < 5)

printf("CppBuzz.com");

}
(A) 4 times
(B) 5 times
(C) 0 time
(D) Infinite times

Ans: B

Question: 21

How many times CppBuzz.com is printed on console?

void main()
{

int a = 0;

while(a==0)

printf("CppBuzz.com");

}
(A) 0 times
(B) Infinite times (Untill Stack is overflow)
(C) 1 time
(D) Nothing is printed

Ans: B

Question: 22

What is printed on console?

void main()

int a = 0;

while(a)

printf("CppBuzz.com");

}
(A) CppBuzz.com is printed Infinite times
(B) CppBuzz.com is printed 1 time only
(C) Nothing is printed
(D) Program gives error

Ans: C

Question: 23

What is output of below program?

void main()

for(; ;);

for(; ;);

printf("Hello");

}
(A) Compilation Error
(B) Runtime Error
(C) Nothing is printed
(D) Hello is printed infinite times

Ans: C

Question: 24

What is meaning of below lines?

void sum (int, int);


(A) sum is function which takes int arguments
(B) sum is a function which takes two int arguments and returns void
(C) it will produce compilation error
(D) Can't comment
Ans: B

Question: 25

What is the following is invalid header file in C?


(A) math.h
(B) mathio.h
(C) string.h
(D) ctype.h

Ans: B

Question: 26

Libray function getch() belongs to which header file?

(A) stdio.h
(B) conio.h
(C) stdlib.h
(D) stdlibio.h

Ans: B

Question: 27

What is storage class for variable A in below code?

void main()

int A;

A = 10;

printf("%d", A);

}
(A) extern
(B) auto
(C) register
(D) static

Ans: B

Question: 28

Can we declare function inside structure of C Programming?

(A) Yes
(B) No
(C) Depends on Compiler
(D) Yes but run time error

Ans: B

Question: 29

#include<stdio.h>

int main()

int a = 10;

printf("%d", a);

int a = 20;

printf("%d",a);

return 0;

}
(A) 1020
(B) 1010
(C) 2020
(D) Error: Redeclartion of a

Ans: D

Question: 30

What is the job of Assembler in C programming?


(A) It converts source code into assembly code
(B) It converts a assembly language program into machine language
(C) It convert code generated by Preprocessor to assembly code
(D) None of the above

Ans: B

You might also like