Q.1 Find the output of the following C code?


a) HI PROGRAMMERS!a;

b) HI PROGRAMMERS! followed by a junk value

c) Compile-time error

d) HI PROGRAMMERS!

Answer: c) Compile time error.

Explanation: It results in an error since a is used without declaring the variable a.




Q.2 What will be the output of the following C code?

a) Compile time error

b) Hello World! 34

c) Hello World! 1000

d) Hello World! followed by a junk value


Answer: a) Compile time error.


Explanation: Since y is already defined, redefining it results in an error.



Q.3 What will be the answer to the following question?

Which of the following is not a variable name declaration?

a) float PI=3.14

b) double b=3.14

c) int a_b=3.14

d) float 1PI=3.14

e) NONE

d) All are valid

Answer: d) float 1PI=3.14


Q.4 What will be the answer to the following question?


The format identifier ‘%i’ is also used for _____ data type.

a) char

b) int

c) float

d) double

Answer: b) int



Q.5 What will be the output of the following C code?


a) false, 0 b) true, 0 c) true, 10 d) compile-time error
Answer: b) true, 0.


Q.6 What will be the output of the following C code?
Answer: a) All is well I am Well.


Q.7 What will be the output of the following C code?


a) Compile-time error

b) Hello is printed thrice

c) Nothing

d) Varies

Answer: a) Compile Time Error


Q.8 What will be the output of the following C code?

a) Run time error

b) Hello is printed thrice

c) Hello is printed twice

d) Hello is printed infinitely

Answer: b) Hello is printed thrice.


Q.9 What will be the output of the following C code?

a) Infinite Loop with no output

b) Infinite Loop with output "In while loop "

c) Compilation Error

d) Infinite Loop with output "In while loop After loop"

Answer: a) Infinite loop with no output.


Q.10 What will be the output of the following C code?
Answer: b) In while loop after the loop.


Q.11 What will be the output of the following C code?


a) Hello is printed infinite times

b) Hello

c) Varies

d) Compile-time error

Answer: d) Compile time error.


Q.12 What will be the output of the following C code?

a) 1

b) Compile-time error

c) Some garbage value

d) Undefined variable

Answer: a) 1.


Q.13 What will be the answer to the following question?

What are the elements present in the array of the following
C code? : int array[4]={6};

a) 6666

b) 6000

c) Garbage value

d) Run Time Error

Answer: b) 6000


Q.14 What will be the answer to the following question?

Which is correct with respect to the size of the data types?

a) char>int>float

b) double>char>int

c) char<int<float

d) int>char>float

Answer: c) char<int<float


Q.15 What will be the output of the following C code?


a) a

b) run time error

c) a.0000000

d) 97.000000

Answer: d) 97.000000
Explanation: Since the ASCII value of a is 97, the same is assigned to the float variable and printed.

Post a Comment

Previous Post Next Post