Explore topic-wise MCQs in C Programming.

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

1.

Which is the header that should be included first?

A. my_global.h
B. my_sys.h
C. mysql.h
D. my_local.h
Answer» B. my_sys.h
2.

How many of the following do not support ‘BIT’ data type?

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

Which function returns a reference to hash of row values?

A. fetchrow_array()
B. fetchrow_arrayref()
C. fetch()
D. fetchrow_hashref()
Answer» E.
4.

In which mode is the indicator of the presence/absence of a word in search used?

A. Natural language
B. Boolean mode
C. Query expansion
D. Cross mode
Answer» C. Query expansion
5.

The mode of search is the search string parsed into words and the search looks for rows is ______________

A. Boolean mode
B. Natural language
C. Query expansion
D. Cross mode
Answer» C. Query expansion
6.

What is the result of the expression:

A. 1011
B. 11
C. 13
D. 1101
Answer» B. 11
7.

What is the output of the snippet of code shown below?

A. error
B. no output
C. hello
D. morning
Answer» D. morning
8.

The output of the snippet of code shown below?

A. TrueTrue
B. FalseTrue
C. FalseFalse
D. TrueFalse
Answer» E.
9.

What is the result of the snippet of code shown below if x=1?

A. 8
B. 1
C. 2
D. 4
Answer» E.
10.

What is the value of x if:

A. 8
B. 4
C. 2
D. 1
Answer» B. 4
11.

The output of the expression is:

A. ‘0b10111’
B. ‘0b11101’
C. ‘0b11111’
D. ‘0b11011’
Answer» C. ‘0b11111’
12.

What is the value of the expression:

A. 5.0
B. 5
C. 4.0
D. 4
Answer» D. 4
13.

Which among the following list of operators has the highest precedence?

A. <<, >>
B. **
C. |
D. %
Answer» C. |
14.

What is the value of the following expression:

A. (1,3)
B. (0,3)
C. (1,0)
D. (3,1)
Answer» B. (0,3)
15.

What is the output of the following expression:

A. Error
B. 1.0
C. 1.00
D. 1
Answer» C. 1.00
16.

Consider the expression given below. The value of X is:

A. 30.0
B. 30.8
C. 28.4
D. 27.2
Answer» E.
17.

The value of the expression:4 + 3 % 5

A. 4
B. 7
C. 2
D. 0
Answer» C. 2
18.

What is the average value of the code that is executed below ?

A. 85
B. 85.1
C. 95
D. 95.1
Answer» C. 95
19.

What is the return value of trunc() ?

A. int
B. bool
C. float
D. None
Answer» B. bool
20.

What data type is the object below ?L = [1, 23, ‘hello’, 1].

A. list
B. dictionary
C. array
D. tuple
Answer» B. dictionary
21.

Carefully observe the code and give the answer.

A. indentation Error
B. cannot perform mathematical operation on strings
C. hello2
D. hello2hello2
Answer» B. cannot perform mathematical operation on strings
22.

It is not possible for the two’s complement value to be equal to the original value in any case. State whether this statement is true or false.

A. True
B. False
C. May be
D. Can't say
Answer» C. May be
23.

What error occurs when you execute?apple = mango

A. SyntaxError
B. NameError
C. ValueError
D. TypeError
Answer» C. ValueError
24.

Following set of commands are executed in shell, what will be the output?

A. he
B. lo
C. olleh
D. hello
Answer» B. lo
25.

In python we do not specify types,it is directly interpreted by the compiler, so consider the following operation to be performed.>>>x = 13 ? 2objective is to make sure x has a integer value, select all that apply (python 3.xx)

A. x = 13 // 2
B. x = int(13 / 2)
C. x = 13 % 2
D. All of the mentioned
Answer» E.
26.

What are the values of the following expressions:

A. 64, 512, 64
B. 64, 64, 64
C. 512, 512, 512
D. 512, 64, 512
Answer» E.
27.

What is the value of the following expression:8/4/2, 8/(4/2)

A. (1.0, 4.0)
B. (1.0, 1.0)
C. (4.0. 1.0)
D. (4.0, 4.0)
Answer» B. (1.0, 1.0)
28.

Which of the following is the truncation division operator?

A. /
B. %
C. //
D. |
Answer» D. |
29.

What is the value of x if:x = int(43.55+2/2)

A. 43
B. 44
C. 22
D. 23
Answer» C. 22
30.

The output of the line of code shown below is:

A. True
B. False
C. Error
D. No output
Answer» C. Error
31.

What is the output of the following code if the system date is 21st June, 2017 (Wednesday)?

A. [ ]{}
B. [ ][ ]
C. {}[ ]
D. {}{}
Answer» D. {}{}
32.

What is the output of the code show below if a=10 and b =20?

A. 10 20
B. 10 10
C. 20 10
D. 20 20
Answer» D. 20 20
33.

The expression 2**2**3 is evaluates as: (2**2)**3. State whether this statement is true or false.

A. True
B. False
C. May be
D. Can't say
Answer» C. May be
34.

What is the two’s complement of -44?

A. 1011011
B. 11010100
C. 11101011
D. 10110011
Answer» C. 11101011
35.

Which of the following expressions results in an error?

A. int(1011)
B. int(‘1011’,23)
C. int(1011,2)
D. int(‘1011’)
Answer» D. int(‘1011’)
36.

What is the value of this expression?bin(0x8)

A. ‘0bx1000’
B. 8
C. 1000
D. ‘0b1000’
Answer» E.
37.

The following is displayed by a print function call:tomdickharrySelect all of the function calls that result in this output

A. print(”’tom\ndick\nharry”’)
B. print(”’tomdickharry”’)
C. print(‘tom\ndick\nharry’)
D. print(‘tomdickharry’)
Answer» D. print(‘tomdickharry’)
38.

What is the order of precedence in python?i) Parenthesesii) Exponentialiii) Multiplicationiv) Divisionv) Additionvi) Subtraction

A. i,ii,iii,iv,v,vi
B. ii,i,iii,iv,v,vi
C. ii,i,iv,iii,v,vi
D. i,ii,iii,iv,vi,v
Answer» B. ii,i,iii,iv,v,vi
39.

What is the value of the expression:~100?

A. 101
B. -101
C. 100
D. -100
Answer» C. 100
40.

The expression Int(x) implies that the variable x is converted to integer. State whether true or false.

A. True
B. False
C. May be
D. Can't say
Answer» B. False
41.

What is the value of this expression: bin(10-2)+bin(12^4)

A. 0b10000
B. 0b10001000
C. 0b1000b1000
D. 0b10000b1000
Answer» E.
42.

Evaluate the expression given below if A= 16 and B = 15.A % B // A

A. 0.0
B. 0
C. 1.0
D. 1
Answer» C. 1.0
43.

What is the result of the expression if x=15 and y=12:x & y

A. b1101
B. b1101
C. 12
D. 1101
Answer» D. 1101
44.

The result of the expression shown below is:4^12

A. 2
B. 4
C. 8
D. 12
Answer» D. 12
45.

Select all options that print:hello-how-are-you

A. print(‘hello’, ‘how’, ‘are’, ‘you’)
B. print(‘hello’, ‘how’, ‘are’, ‘you’ + ‘-‘ * 4)
C. print(‘hello-‘ + ‘how-are-you’)
D. print(‘hello’ + ‘-‘ + ‘how’ + ‘-‘ + ‘are’ + ‘you’)
Answer» D. print(‘hello’ + ‘-‘ + ‘how’ + ‘-‘ + ‘are’ + ‘you’)
46.

What is the value of the following expression:float(22//3+3/3)

A. 8
B. 8.0
C. 8.3
D. 8.33
Answer» C. 8.3
47.

What is the value of the following expression?2+4.00, 2**4.0

A. (6.0, 16.0)
B. (6.00, 16.00)
C. (6, 16)
D. (6.00, 16.0)
Answer» B. (6.00, 16.00)
48.

What is the result of the expression:0x35 | 0x75

A. 115
B. 116
C. 117
D. 118
Answer» D. 118
49.

If $a represents an array with numeric indices in PHP, the first element accessed by ______________

A. $a[1]
B. $a[0]
C. $a.1
D. $a.0
Answer» C. $a.1
50.

The storage in bytes required for VARCHAR(4) type ‘abcd’ is _____________

A. 1
B. 3
C. 5
D. 8
Answer» D. 8