Wednesday, 24 January 2018

TCS - C Programming Concept MCQ - Set 3

Ques.  Which of this is used to skip one iteration:
A) break
B) continue
C) goto
D) return

Ques. Which of the following does not require to include math.h header file?
A) pow()
B) rand()
D) sinh()

Ques. Which has the highest precision?
A. float
B. double
C. unsigned long int
D. Long int

Ques. Choose the correct statement
while (0 == 0) { }
A) It has syntax error as there are no statements within braces {}
B) It will run forever
C) It compares 0 with 0 and since they are equal it will exit the loop immediately
D) It has syntax error as the same number is being compared with itself

Ques. Predict the output of following code:
int a=10,x;
x= a-- + ++a;
A) 19 ​
B) 20
C) 22 
D) 23

Ques. Guess the output:
        //same as → sizeof(97)

A) 2 or 4 ---
B) 1 or 3
C) Garbage value 
D) ASCII value of a
sizeof takes ascii value of character and determines number of bytes required by it. Ascii is number, Number is of type int. so integer requires either 2 in 16 or 4 in 32 bit machine

Question. Predict the output of following code:
int a=b=c=d=10; 
A) Error
B) 10,10,10,10
C) Garbage Value,Garbage Value,Garbage Value,10
D) Garbage Value,Garbage Value,Garbage Value,Garbage Value
Explaination: error: ‘b’ , ‘c’, ‘d’ undeclared

Ques. Select the missing statement?
long int fact(int n);
int main()
\\missing statement 
long int fact(int n) 
return n*fact(n-1);
return 1;

A) printf(“%ll\n",fact(5));
B) printf("%u\n",fact(5));
C) printf("%d\n",fact(5));
D) printf("%ld\n",fact(5));

Ques. If a function’s return type is not explicitly defined then it’s default to ______ (In C).
A) int
B) float
C) void
D) Error

Ques. How many times the below loop will be executed?
int main()
int i;

A) 5
B) 1
C) 0
D) 3

Also check Chapterwise C - MCQ .

1 comment:

  1. For the sizeof('a') its actually 1
    I compiled in turbo c it produced 1.
    since tcs mcqs are based on programs compiled in turbo c its better to go with 1.


Follow by Email

Popular Posts

Contact Form


Email *

Message *