c programming banner

C Programming Multiple Choice Questions (MCQs) and Answers

Master C Programming with Practice MCQs. Explore our curated collection of Multiple Choice Questions. Ideal for placement and interview preparation, our questions range from basic to advanced, ensuring comprehensive coverage of C Programming. Begin your placement preparation journey now!

Q1

Q1 Why is learning programming important in today's world?

A

For academic purposes only

B

To automate and solve complex problems

C

Only for software development

D

For entertainment purposes only

Q2

Q2 What is the main function of a compiler in programming?

A

To write code

B

To interpret code

C

To convert code into machine language

D

To debug code

Q3

Q3 Which of the following is true about interpreters?

A

They execute programs faster than compilers

B

They translate the entire program at once

C

They translate and execute code line by line

D

They are not used in modern programming

Q4

Q4 How does a compiler differ from an interpreter?

A

A compiler executes code, while an interpreter does not

B

A compiler debugs code, while an interpreter does not

C

A compiler translates the entire program at once, while an interpreter translates it line by line

D

A compiler is used only in C programming, while an interpreter is not

Q5

Q5 What is the primary purpose of writing a "Hello World" program when learning a new programming language?

A

To test if the language supports string operations

B

To learn complex programming concepts

C

To demonstrate basic syntax and output

D

To introduce advanced programming features

Q6

Q6 What will be the output of the following C program?
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}

A

Hello, World!

B

Syntax Error

C

0

D

Nothing

Q7

Q7 Identify the error in this C program:
#include <stdio.h>
int main() {
print("Hello, World!");
return 0;
}

A

Missing #include statement

B

Incorrect function name

C

Syntax error in return statement

D

No error

Q8

Q8 Which of the following is not a keyword in C?

A

int

B

char

C

include

D

float

Q9

Q9 What data type would you use to store a character in C?

A

int

B

float

C

char

D

double

Q10

Q10 Which of the following is a valid identifier in C?

A

2ndName

B

_name

C

#name

D

none of these

Q11

Q11 What is the size of 'int' data type in C?

A

Depends on the system

B

4 bytes

C

8 bytes

D

2 bytes

Q12

Q12 What is the difference between 'float' and 'double' data types in C?

A

Syntax only

B

Precision

C

Usage

D

No difference

Q13

Q13 What will be the output of the following C code?
int main() {
char c = 'A';
printf("%d", c);
return 0;
}

A

65

B

A

C

Syntax Error

D

None of these

Q14

Q14 Identify the error in this C code:
int main() {
int number = 100.5;
printf("%d", number);
return 0;
}

A

Assigning float to int

B

Syntax error

C

No error

D

Wrong printf format

Q15

Q15 Spot the error in this code snippet:
#include <stdio.h>
int main() {
const int age; age = 30;
printf("%d", age);
return 0;
}

A

Uninitialized constant

B

Missing return statement

C

Syntax error in printf statement

D

No error

Q16

Q16 What is the purpose of the printf function in C?

A

To read input

B

To print output

C

To perform calculations

D

To control program flow

Q17

Q17 What does %d signify in the printf or scanf function?

A

Double data type

B

Decimal integer

C

Dynamic allocation

D

Directory path

Q18

Q18 What will be the output of the following C code?
int main() {
printf("%d", 500);
return 0;
}

A

500

B

%d

C

Syntax Error

D

None of these

Q19

Q19 What will the following C code output?
int main() {
int num;
scanf("%d", &num);
printf("%d", num);
return 0;
}

A

The inputted number

B

%d

C

Syntax Error

D

Nothing

Q20

Q20 Pseudocode:

READ number PRINT "The number is ", number
What does this pseudocode do?

A

Reads and prints a number

B

Prints a fixed number

C

Generates a random number

D

None of these

Q21

Q21 Identify the error in this C code:
int main() {
int x;
scanf("%d", x);
printf("%d", x);
return 0;
}

A

Missing & in scanf

B

Wrong format specifier

C

No error

D

Syntax error

Q22

Q22 Find the mistake in this code:
int main() {
float num;
printf("Enter a number: ");
scanf("%f", num);
printf("You entered: %f", num);
return 0;
}

A

Missing & in scanf

B

Incorrect format specifier in printf

C

No error

D

Syntax error

Q23

Q23 Which operator is used for division in C?

A

-

B

*

C

/

D

=+

Q24

Q24 What does the '==' operator check?

A

Assignment

B

Equality

C

Greater than

D

Less than

Q25

Q25 What is the result of the logical expression (1 && 0)?

A

1

B

0

C

True

D

False

Q26

Q26 What does the '+' operator do in C?

A

Addition

B

Subtraction

C

Multiplication

D

Division

Q27

Q27 Which operator has higher precedence, '+' or '*'?

A

*

B

Both are same

C

=+

D

None

Q28

Q28 What does the '!' operator do in C?

A

Negation

B

Addition

C

Multiplication

D

None

Q29

Q29 What is the output of the expression 2<3?

A

0

B

1

C

2

D

3

Q30

Q30 What will be the output of the following C code?
int main() {
int a = 10, b = 5;
printf("%d", a / b);
return 0;
}

A

2

B

5

C

0

D

10

...
ad verticalad vertical
ad