Explore topic-wise MCQs in C Programming.

This section includes 191 Mcqs, each offering curated multiple-choice questions to sharpen your C Programming knowledge and support exam preparation. Choose a topic below to get started.

151.

The declaration    int x : 4; means

A. x is a four digit integer
B. x cannot be greater than a four digit integer
C. x is a four-bit integer
D. none of above
Answer» D. none of above
152.

What is the correct way to round offx, a float, to an int value?

A. y=(int)(x+0.5)
B. y=int(x+0.5)
C. y=(int)x+0.5
D. y=(int)(int)x+0.5)
Answer» B. y=int(x+0.5)
153.

The format identifier %i is also used for _____ data type?

A. char
B. int
C. float
D. double
Answer» C. float
154.

The C declarationint b [100];reserves ____________ successive memory locations,each large enough to contain single integer.

A. 200
B. 10,000
C. 100
D. 10
Answer» D. 10
155.

Pick the operators that assosciate from the left

A. +
B. ,
C. <
D. All of the above
Answer» E.
156.

Which of the following is not user defined data type?1 :struct book{ char name[10]; float price; int pages;};2 :long int l = 2.35;3 :enum day {Sun, Mon, Tue, Wed};

A. 1
B. 2
C. 3
D. Both 1 and 2
Answer» C. 3
157.

Which of the following is the correct order of evaluation for the given expression?a = w % x / y * z;

A. % / * =
B. / * % =
C.
Answer» B. / * % =
158.

Array is ______ datatype in C Programming language.

A. Derived Data type
B. Primitive Data type
C. Custom Data type
D. None of these
Answer» B. Primitive Data type
159.

Is there any difference between following declarations?1 :extern int fun();2 :int fun();

A. Both are identical
B. No difference, except extern int fun(); is probably in another file
C. int fun(); is overrided with extern int fun();
D. None of these
Answer» C. int fun(); is overrided with extern int fun();
160.

What care must be taken during swapping 2 numbers? b = (b / a); a = a * b; b = a / b;

A. Data type should be either of short, int and long
B. Data type should be either of float and double
C. All data types are accepted except for (char *)
D. This code doesn’t swap 2 numbers
Answer» C. All data types are accepted except for (char *)
161.

Local Variable is having _______ scope.

A. inter program
B. local
C. global
D. only inside current Program
Answer» C. global
162.

Which of the following option is the correct representation of the following code?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» E.
163.

In which order do the following gets evaluated in C Programming -1. Relational2. Arithmetic3. Logical4. Assignment

A. 1234
B. 2143
C. 3214
D. 2134
Answer» E.
164.

The statement    printf( " % f ", ( float )9/5) ; prints

A. 1.8
B. 1.0
C. 2.0
D. none of these
Answer» B. 1.0
165.

By default, any real number in 'C' is treated as

A. A float
B. A double
C. A long double
D. Depend upon memory model that you are using
Answer» C. A long double
166.

Which of the following has same Precedence?

A. A and B
B. B and C
C. A and C
D. All has same Precedence
Answer» B. B and C
167.

The expression 4 + 6 / 3 * 2 - 2 + 7 % 3 evaluates to

A. 3
B. 4
C. 6
D. 7
Answer» E.
168.

Choose the correct answer

A. Enum variables can not be assigned new values
B. Enum variables can be compared
C. Enumeration feature increase the power of C
D. All of above
Answer» D. All of above
169.

If i j,k are integer variable with values 1,2,3 respectively, then what is the value of the expression !((j + k) > (i + 5))

A. 6
B. 5
C. 1
D. 0
Answer» D. 0
170.

The minimum number of temporary variable needed to swap the content two variables is?

A. 2
B. 3
C. 0
D. 1
Answer» D. 1
171.

The value of an automatic variable that is declared but not initialized will be

A. 0
B. Null
C. Garbage
D. None of these
Answer» D. None of these
172.

What will be the data type of the expression (a < 50) ? var1 : var2; provided a = int, var1 = double, var2 = float

A. int
B. float
C. double
D. Cannot be determined
Answer» D. Cannot be determined
173.

For the following code snippet: char *str = “compscibits.com\0” “training classes”; The character pointer str holds reference to string:

A. compscibits.com
B. compscibits.com\0training classes
C. compscibits.comtraining classes
D. Invalid declaration
Answer» C. compscibits.comtraining classes
174.

What is the output of this C code (on a 32-bit machine)?

A. p and q are 4 and 4
B. p and q are 4 and 8
C. Compiler error
D. p and q are 2 and 8
Answer» B. p and q are 4 and 8
175.

What is the output of the following C code(on a 64 bit machine)?

A. 8
B. 5
C. 9
D. 4
Answer» E.
176.

What will happen if the below program is executed?

A. It will cause a compile-time error
B. It will cause a run-time error
C. It will run without any error and prints 3
D. It will experience infinite looping
Answer» D. It will experience infinite looping
177.

What is the problem in following variable declaration?float 3Bedroom-Hall-Kitchen?;

A. The variable name begins with an integer
B. The special character ‘-‘
C. The special character ‘?’
D. All of the above
Answer» E.
178.

#include

A. %f
B. %d
C. %c
D. %s
Answer» B. %d
179.

Does this compile without error?

A. Yes
B. No
C. Depends on the compiler
D. Depends on the C standard implemented by compilers
Answer» B. No
180.

enum types are processed by

A. Compiler
B. Preprocessor
C. Linker
D. Assembler
Answer» B. Preprocessor
181.

Which is false?

A. Constant variables need not be defined as they are declared and can be defined later
B. Global constant variables are initialised to zero
C. const keyword is used to define constant values
D. You cannot reassign a value to a constant variable
Answer» B. Global constant variables are initialised to zero
182.

What is the value of x in this C code?

A. 3.75
B. Depends on compiler
C. 24
D. 3
Answer» D. 3
183.

Are logical operators sequence points?

A. True
B. False
C. Depends on the compiler
D. Depends on the standard
Answer» B. False
184.

What is the final value of j in the below code?

A. 0
B. 20
C. Compile time error
D. Depends on language standard
Answer» B. 20
185.

Result of a logical or relational expression in C is

A. True or False
B. 0 or 1
C. 0 if expression is false and any positive number if expression is true
D. None of the mentioned
Answer» C. 0 if expression is false and any positive number if expression is true
186.

Does logical operators in C language are evaluated with short circuit?

A. True
B. False
C. Depends on the compiler
D. Depends on the standard
Answer» B. False
187.

What will be the value of d in the following program?

A. Syntax error
B. 1
C. 5
D. 10
Answer» C. 5
188.

What is the output of this C code? (7 and 8 are entered)

A. 7.000000, 7
B. Run time error
C. 7.000000, junk
D. Varies
Answer» D. Varies
189.

Relational operators cannot be used on:

A. structure
B. long
C. strings
D. float
Answer» B. long
190.

When double is converted to float, the value is?

A. Truncated
B. Rounded
C. Depends on the compiler
D. Depends on the standard
Answer» D. Depends on the standard
191.

C99 standard guarantess uniqueness of _____ characters for external names.

A. 31
B. 6
C. 12
D. 14
Answer» B. 6