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.

101.

Which operator from the following has the lowest priority?

A. Assignment operator
B. Division operator
C. Comma operator
D. Conditional operator
Answer» D. Conditional operator
102.

Which type 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» C. From negative int to char
103.

What is the output of the below code considering size of short int is 2, char is 1 and int is 4 bytes?

A. 2, 1, 2
B. 2, 1, 1
C. 2, 1, 4
D. 2, 2, 8
Answer» D. 2, 2, 8
104.

Function tolower(c) defined in library works for

A. Ascii character set
B. Unicode character set
C. Ascii and utf-8 but not EBSIDIC character set
D. Any character set
Answer» E.
105.

What is the difference between the following 2 codes?

A. No difference as space doesn’t make any difference, values of a, b, d are same in both the case
B. Space does make a difference, values of a, b, d are different
C. Program 1 has syntax error, program 2 is not
D. Program 2 has syntax error, program 1 is not
Answer» E.
106.

Which of the following is not a logical operator?

A. !
B. &&
C. ||
D. |
Answer» E.
107.

Which function in the following expression will be called first?a = func3(6) - func2(4, 5) / func1(1, 2, 3);

A. func1();
B. func2();
C. func3();
D. Cannot be predicted
Answer» E.
108.

If a is an unsigned integer variable whose value is hx6db7, what is the value of -a?

A. h llhhhhl
B. hxhhl
C. hx248
D. hx9248
Answer» E.
109.

Which of the following is correct about err used in the declaration given below? typedef enum error { warning, test, exception } err;

A. It is a typedef for enum error.
B. It is a variable of type enum error.
C. The statement is erroneous.
D. It is a structure.
Answer» B. It is a variable of type enum error.
110.

Identify which of the following are declarations1 :extern int x;2 :float square ( float x ) { ... }3 :double pow(double, double);

A. 1
B. 2
C. 1 and 3
D. 3
Answer» D. 3
111.

Literal means

A. a string
B. a string constant
C. a character
D. an alphabet
Answer» C. a character
112.

int i = 5; is a statement in a C program.

A. during execution, value of i may change but not its address
B. during execution both the address and value may change
C. repeated execution may result in different addresses for i
D. i may not have an associated address
Answer» D. i may not have an associated address
113.

What will be the data type of the result of the following operation?(float)a * (int)b / (long)c * (double)d

A. int
B. long
C. float
D. double
Answer» E.
114.

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» C. P and R
115.

Which of the following correctly shows the hierarchy of arithmetic operations in C?

A. / + * -
B. * - / +
C. + - / *
D. / * + -
Answer» E.
116.

Declare the following statement?"A pointer to a function which receives an int pointer and returns float pointer".

A. float *(ptr)*int;
B. float *(*ptr)(int)
C. float *(*ptr)(int*)
D. float (*ptr)(int)
Answer» D. float (*ptr)(int)
117.

Which of the following option is the correct representation of the following C statement?

A. e = (a * (b +(c /(d * f))));
B. e = ((a * b) + (c / (d * f)));
C. e = ((a * b) + ((c / d)* f));
D. Both b and c
Answer» E.
118.

What will be output for the following code?

A. 3 4
B. 4 4
C. 3 5
D. 2 4
Answer» B. 4 4
119.

Which of the following operator has lowest Precedence?

A. ||
B. ,
C. ?:
D.
Answer» C. ?:
120.

Which of the following is correct Associativity for == operator?

A. Left to right
B. Right to left
C. Left to left
D. Right to right
Answer» B. Right to left
121.

Which of the following operator has highest Precedence?

A. *
B. /
C. ~
D. []
Answer» E.
122.

If the declaration unsigned c:5; is replaced byunsigned : 6; then

A. it results in a syntax error
B. it is meaningless
C. compiler will give a new name for the field
D. none of these
Answer» D. none of these
123.

In an expression involving || operator, evaluationI. Will be stopped if one of its components evaluates to falseII. Will be stopped if one of its components evaluates to trueIII. Takes place from right to leftIV. Takes place from left to right

A. I and II
B. I and III
C. II and III
D. II and IV
Answer» E.
124.

In order to create a local variable we need to use local keyword. local int var;

A. True
B. False
C. Optional
D. None of the above
Answer» C. Optional
125.

Pick the operators that assosiate from left to right

A. &&
B. ?:
C. ,
D. All of the above
Answer» E.
126.

Pick the operators whose meaning is context dependent

A. *
B. #
C. &
D. All of the above
Answer» E.
127.

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» E.
128.

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» E.
129.

In an operation involving || operator, evaluation

A. takes place from left to right
B. will be stopped if one of its components evaluates to true
C. takes place from right to left
D. both (a) and (b)
Answer» E.
130.

For initialization a = 2, c = 1 the value of a and c after this code will be c = (c) ? a = 0 : 2;

A. a = 0, c = 0;
B. a = 2, c = 2;
C. a = 2, c = 2;
D. a = 1, c = 2;
Answer» B. a = 2, c = 2;
131.

for c = 2, value of c after c <<= 1;

A. c = 1;
B. c = 2;
C. c = 3;
D. c = 4;
Answer» E.
132.

The declaration enum cities{ bethlehem, jericho, nazareth = 1, jerusalem } assigns the value 1 to

A. bethlehem
B. nazareth
C. bethIehem and nazareth
D. jericho and nazareth
Answer» E.
133.

What is the value of the below assignment expression (x = foo())!= 1 considering foo() returns 2

A. 2
B. True
C. 1
D. 0
Answer» B. True
134.

Consider the statements: putchar ( getchar ( )); putchar(getchar( ));If a b is the input, the output will be

A. an error message
B. this can't be the input
C. ab
D. a   b
Answer» C. ab
135.

Pick the operators that assosiate from the right

A. ?:
B. +=
C.
D. All of the above
Answer» E.
136.

A static variable

A. cannot be initialized
B. is initialized once at the commencement of execution and cannot be changed at run time
C. retains its value throughout the file of the program
D. is same as an automatic variable but is placed at the head of a program
Answer» D. is same as an automatic variable but is placed at the head of a program
137.

If integer needs two bytes of storage, then maximum value of a signed integer is

A. 2^16 - 1
B. 2^15-1
C. 2^16
D. 2^15
Answer» C. 2^16
138.

Which of the following comments about wide characters is/are true ?

A. it is binary representation of a character in the extended binary set
B. it is of integer type wchar_t
C. end of file is represented by WEOF
D. All of the above
Answer» E.
139.

The expression 5 - 2 - 3 * 5 - 2 will evaluate to 18, if - is left associative and

A. * has precedence over *
B. * has precedence over -
C. - has precedence over *
D. - has precedence over -
Answer» D. - has precedence over -
140.

What do the following declaration signify?char **argv;

A. argv is a pointer to pointer.
B. argv is a pointer to a char pointer.
C. argv is a function pointer.
D. argv is a member of function pointer.
Answer» C. argv is a function pointer.
141.

In a 'C'expression involving || operator, evaluation

A. Will be stopped if one of its components evaluates to false
B. Will be stopped if one of its components evaluates to true
C. Takes place from right to left
D. None of these
Answer» C. Takes place from right to left
142.

Which of the following are unary operators in C?1. !2. sizeof3. ~4. &&

A. 1, 2
B. 1, 3
C. 2, 4
D. 1, 2, 3
Answer» E.
143.

Which of the structure is incorrcet?1 :struct aa{ int a; float b;};2 :struct aa{ int a; float b; struct aa var;};3 :struct aa{ int a; float b; struct aa *var;};

A. 1
B. 2
C. 3
D. 1, 2, 3
Answer» C. 3
144.

Which of the following is correct use of Conditional Operator ?

A. a>b ? c=10;
B. max = a>b ? a>c?a:c:b>c?b:c
C. a>b ? c=50 : c=140;
D. a>b : c=10;
Answer» C. a>b ? c=50 : c=140;
145.

Which of the structure is correct?1 :struct book{ char name[10]; float price; int pages;};2 :struct aa{ char name[10]; float price; int pages;}3 :struct aa{ char name[10]; float price; int pages;}

A. 1
B. 2
C. 3
D. All of above
Answer» B. 2
146.

What do the following declaration signify?char *arr[10];

A. arr is a array of 10 character pointers.
B. arr is a array of function pointer.
C. arr is a array of characters.
D. arr is a pointer to array of characters.
Answer» B. arr is a array of function pointer.
147.

Declare the following statement?"A pointer to a function which receives nothing and returns nothing".

A. void *(ptr)*int;
B. void *(*ptr)()
C. void *(*ptr)(*)
D. void (*ptr)()
Answer» E.
148.

How would you round off a value from 6.66 to 7.0?

A. ceil(6.66)
B. floor(6.66)
C. roundup(6.66)
D. roundto(6.66)
Answer» B. floor(6.66)
149.

How many keywords are there in c ?

A. 31
B. 32
C. 64
D. 63
Answer» C. 64
150.

The statement   int **a;

A. is illegal
B. is legal but meaningless
C. is syntactically and semantically correct
D. none of these
Answer» D. none of these