0% found this document useful (0 votes)
28 views

C Language 5

The document contains 50 multiple choice questions about C language concepts including: 1. Logical operators in C are evaluated with short-circuit evaluation. 2. Relational and logical expressions in C result in 0 or 1. 3. Relational operators cannot be used on structures. 4. The != operator is a logical and relational operator while = is not. 5. Topics covered include data types, operators, precedence, conversions, and I/O functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

C Language 5

The document contains 50 multiple choice questions about C language concepts including: 1. Logical operators in C are evaluated with short-circuit evaluation. 2. Relational and logical expressions in C result in 0 or 1. 3. Relational operators cannot be used on structures. 4. The != operator is a logical and relational operator while = is not. 5. Topics covered include data types, operators, precedence, conversions, and I/O functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

C Language MCQs [set-2]

Chapter: Introduction to C Language

26. Do logical operators in the C language are evaluated with the short
circuit?

A. True

B. False o m
.c
C. Depends on the compiler
te
D. Depends on the standard a
Answer: A
q M
c
M
27. What is the result of logical or relational expression in C?

A. True or False

B. 0 or 1

C. 0 if an expression is false and any positive number if an expression is true

D. None of the mentioned

Answer: B

28. Relational operators cannot be used on ____________

A. structure

B. long

C. strings

D. float

Answer: A

29. Which among the following is NOT a logical or relational operator?

Download more at McqMate.com


A. !=

B. ==

D. =

Answer: D

30. What is the type of the following assignment expression if x is of type


float and y is of type int? y = x + y;

A. int

o m
B. float
.c
C. there is no type for an assignment expression
te
a
D. double

q M
Answer: A
c
M
31. What will be the value of the following assignment expression? (x =
foo())!= 1 considering foo() returns 2

A. 2

B. True

C. 1

D. 0

Answer: A

32. Operation “a = a * b + a” can also be written as ___________

A. a *= b + 1;

B. (c = a * b)!=(a = c + a);

C. a = (b + 1)* a;

D. All of the mentioned

Answer: D

33. What will be the final value of c in the following C statement? (Initial

Download more at McqMate.com


value: c = 2) c <<= 1;

A. c = 1;

B. c = 2;

C. c = 3;

D. c = 4;

Answer: D

m
34. In expression i = g() + f(), first function called depends on __________
o
A. Compiler
.c
te
B. Associativiy of () operator
a
C. Precedence of () and + operator
q M
D. Left to write of the expression
c
Answer: A M
35. Which operators of the following have same precedence? P. "!=", Q.
"+=", R. "<<="

A. P and Q

B. Q and R

C. P and R

D. P, Q and R

Answer: B

36. Comment on the following statement n = 1; printf("%d, %dn", 3*n, n++);

A. Output will be 3, 2

B. Output will be 3, 1

C. Output will be 6, 1

D. Output is compiler dependent

Answer: D

Download more at McqMate.com


37. Which is correct representation of C statement? e = a * b + c / d * f;

A. e = (a * (b +(c /(d * f))));

B. e = ((a * b) + (c / (d * f)));

C. e = ((a * b) + ((c / d)* f));

D. Both e = ((a * b) + (c / (d * f))); and e = ((a * b) + ((c / d)* f));

Answer: D

o m
38. While swapping 2 no’ what at precautions to be taken care? b = (b / a);
a = a * b; b = a / b; .c
te
A. Data type should be either of short, int and long a
q M
B. Data type should be either of float and double

c
M
C. All data types are accepted except for (char *)

D. This code doesn’t swap 2 numbers

Answer: B

39. function tolower(c) defined in library <ctype.h> works for ___________

A. Ascii character set

B. Unicode character set

C. Ascii and utf-8 but not EBCDIC character set

D. Any character set

Answer: D

40. Which type of conversion is NOT accepted?

A. From char to int

B. From float to char pointer

C. From negative int to char

D. From double to char

Answer: B

Download more at McqMate.com


41. Which of the following type-casting have chances for wrap around?

A. From int to float

B. From int to char

C. From char to short

D. From char to int

Answer: B

m
o by C?
c
42. Which of the following typecasting is accepted
.
e
A. Widening conversions
at
B. Narrowing conversions
q M
c
C. Widening & Narrowing conversions

D. None of the mentionedM


Answer: C

43. When do you need to use type-conversions?

A. The value to be stored is beyond the max limit

B. The value to be stored is in a form not supported by that data type

C. To reduce the memory in use, relevant to the value

D. All of the mentioned

Answer: D

44. What is the scope of an external variable?

A. Whole source file in which it is defined

B. From the point of declaration to the end of the file in which it is defined

C. Any source file in a program

D. From the point of declaration to the end of the file being compiled

Answer: D

Download more at McqMate.com


45. What is the scope of a function?

A. Whole source file in which it is defined

B. From the point of declaration to the end of the file in which it is defined

C. Any source file in a program

D. From the point of declaration to the end of the file being compiled

Answer: D

o m
c
46. In the standard library of C programming language, which of the
following header file is designed for basic .mathematical operations?
te
a
A. math.h

q M
B. conio.h
c
C. dos.h

D. stdio.h
M
Answer: A

47. Which of the following statements should be used to obtain a


remainder after dividing 3.14 by 2.1 ?

A. rem = 3.14 % 2.1;

B. rem = modf(3.14, 2.1);

C. rem = fmod(3.14, 2.1);

D. Remainder cannot be obtain in floating point division.

Answer: C

48. By default a real number is treated as a

A. A.float

B. B.double

C. C.long double

Download more at McqMate.com


D. D. far double

Answer: B

Chapter: Managing IO Operations

49. Which among the following is the odd one out?

A. printf

B. fprintf

C. putchar
o m
D. scanf .c
te
Answer: D
a
q M
c
50. For a typical program, the input is taken using _________

A. scanf M
B. Files

C. Command-line

D. All of the mentioned

Answer: D

Download more at McqMate.com


Take Quick Mock/Practice test on this topic HERE

For Discussion / Reporting / Correction of any MCQ please visit discussion page by clicking on
'answer' of respective MCQ.

McqMate is also available on

PlayStore

o m
.c
te
a
q M
c
M

Download more at McqMate.com

You might also like