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.
b) double b=3.14
c) int a_b=3.14
d) float 1PI=3.14
e) NONE
d) All are valid
c) float
d) double
Answer: b) 6000
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.
Answer: b) true, 0.
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?
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?
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