You are currently viewing The Best 50 MCQ on C Language with Answers
C Language Question with Answers

The Best 50 MCQ on C Language with Answers

  • Post author:
  • Post last modified:June 13, 2023
  • Reading time:29 mins read

MCQ on C Language with Answers: Welcome to our blog post on “The Best 50 MCQ on C Language with Answers”! This 50 MCQ on C will assess your understanding of the C Programming Language. It will help both beginner, intermediate and experienced programmers aiming to test their knowledge. These MCQs will help you to pass BCA, BTech, or any other competitive examination. To get benefits from these 50 MCQ on C Language with Answers, you must try the MCQ options first. And see the answer below after 50 MCQ as well as “View Answer”.

Table of Contents

MCQ on C Language with Answers: MCQ on C

1. Which of the following is not a valid data type in C Language?

a) int
b) float
c) real
d) char

View Answer
c) real

2. Which operator is used to access the value at a specific memory address?

a) &
b) *
c) $
d) %

View Answer
b) *

3. What is the result of the expression 6 + 4 / 2 * 3 – 1?

a) 10
b) 12
c) 15
d) 11

View Answer
d) 11

4. What is the correct way to declare an array in C Language?

a) int array[];
b) int array[10];
c) array[] = {1, 2, 3};
d) array[10] = {1, 2, 3};

View Answer
b) int array[10];
MCQ on C
MCQ on C Language

5. What is the output of the following code snippet?

int x = 5;
printf(“%d”, ++x);
a) 4
b) 5
c) 6
d) 10

View Answer
c) 6

6. What is the purpose of the size operator in C?

a) It determines the size of objects
b) It returns the address of a variable.
c) It returns the ASCII value of a character.
d) It returns the value of a variable.

View Answer
a) To determine the size of objects

7. What is the output of the following code snippet?

int x = 10;
printf(“%d”, x++);

a) 9
b) 10
c) 11
d) 12

View Answer
b) 10

8. Which loop construct is used for executing a block of code repeatedly until a condition is satisfied?

a) for
b) while
c) do-while
d) if-else

View Answer
b) while

9. What is the correct way to define a constant in C Language?

a) #define CONSTANT 10
b) const CONSTANT = 10;
c) constant CONSTANT = 10;
d) constant = 10;

View Answer
a) #define CONSTANT 10

10. What is the output of the following code snippet?

int x = 5;
printf(“%d”, x–);

a) 4
b) 5
c) 6
d) 10

View Answer
a) 5

11. What is the purpose of the “break” statement in C Language?

a) It terminates the current loop and transfers control to the next iteration.
b) It transfers control to a specified label within the current function.
c) It skips the remaining statements in a loop and continues with the next iteration.
d) It exits the current function and returns a value.

View Answer
a) It terminates the current loop and transfers control to the next iteration.

12. Which header file is required to use the printf and scanf functions in C?

a) stdlib.h
b) string.h
c) math.h
d) stdio.h

View Answer
d) stdio.h

13. What is the output of the following code snippet?

int x = 5;
printf(“%d”, x++);
printf(“%d”, x);

a) 5, 5
b) 5, 6
c) 6, 5
d) 6, 6

View Answer
b) 5, 6

14. What is the purpose of the “continue” statement in C Language?

a) It terminates the current loop and transfers control to the next iteration.
b) It transfers control to a specified label within the current function.
c) It skips the remaining statements in a loop and continues with the next iteration.
d) It exits the current function and returns a value.

View Answer
a) It terminates the current loop and transfers control to the next iteration.

15. What is the output of the following code snippet?

int x = 2;
int y = 4;
printf(“%d”, x << y);

a) 2
b) 4
c) 32
d) 16

View Answer
c) 32

16. What is the purpose of the “else” statement in an if-else construct?

a) It is used to specify the condition for the if statement.
b) It is used to specify the block of code to be executed if the condition in the if statement is true.
c) It is used to specify the block of code to be executed if the condition in the if statement is false.
d) It is used to specify the block of code to be executed in all cases.

View Answer
c) It is used to specify the block of code to be executed if the condition in the if statement is false.

17. Which of the following is a valid way to declare a pointer in C Language?

a) int *ptr;
b) *int ptr;
c) ptr int *;
d) pointer int;

View Answer
a) int *ptr;

17. What is the output of the following code snippet?

int x = 10;
int y = (x > 5) ? 2 : 1;
printf(“%d”, y);

a) 2
b) 1
c) 10
d) 5

View Answer
a) 2

19. Which of the following is not a logical operator in C Language?

a) &&
b) ||
c) !
d) ^^

View Answer
d) ^^

20. What is the output of the following code snippet?

int x = 5;
int y = sizeof(++x);
printf(“%d”, x);

a) 4
b) 5
c) 6
d) 10

View Answer
b) 5

21. What is the purpose of the “return” statement in C Language?

a) It terminates the current loop and transfers control to the next iteration.
b) It transfers control to a specified label within the current function.
c) It skips the remaining statements in a loop and continues with the next iteration.
d) It exits the current function and returns a value.

View Answer
d) It exits the current function and returns a value.

22. Which of the following is not a valid way to define a string in C Language?

a) char str[] = “Hello”;
b) char *str = “Hello”;
c) char str[6] = {‘H’, ‘e’, ‘l’, ‘l’, ‘o’, ‘\0’};
d) char str[6] = “Hello”;

View Answer
d) char str[6] = “Hello”;
MCQ on C Language
MCQ on C Language:MCQ on C Language with Answers

23. What is the output of the following code snippet?

int x = 5;
int y = x + 2 * 3;
printf(“%d”, y);

a) 5
b) 11
c) 15
d) 23

View Answer
b) 11

Read More

The Best 50 MCQ On Python Language With Answers

Best 50 Java Multiple-Choice Questions To Test Your Skills, And Boost Your Knowledge

The Best 50 Java Interview Questions With Answers

60 Python Interview Questions Answers

24. What is the purpose of the “&&” operator in C Language?

a) It performs logical AND operation between two operands.
b) It performs logical OR operation between two operands.
c) It performs bitwise AND operation between two operands.
d) It performs bitwise OR operation between two operands.

View Answer
a) It performs logical AND operation between two operands.

25. What is the output of the following code snippet?

int x = 10;
if (x > 5 && x < 15)
printf(“True”);
else
printf(“False”);

a) True
b) False
c) Error
d) No output

View Answer
a) True

26. What is the purpose of the “||” operator in C Language?

a) It performs logical AND operation between two operands.
b) It performs logical OR operation between two operands.
c) It performs bitwise AND operation between two operands.
d) It performs bitwise OR operation between two operands.

View Answer
b) It performs logical OR operation between two operands.

27. What is the output of the following code snippet?

int x = 10;
if (x > 5 || x < 15)
printf(“True”);
else
printf(“False”);

a) True
b) False
c) Error
d) No output

View Answer
a) True

28. What is the purpose of the “!” operator in C Language?

a) It negates the value of a variable.
b) It performs logical AND operation between two operands.
c) It performs logical OR operation between two operands.
d) It performs bitwise XOR operation between two operands.

View Answer
a) It negates the value of a variable.

29. What is the output of the following code snippet?

int x = 5;
if (!(x > 10))
printf(“True”);
else
printf(“False”);

a) True
b) False
c) Error
d) No output

View Answer
a) True

30. What is the purpose of the “switch” statement in C Language?

a) It is used to specify the condition for the if statement.
b) It is used to specify the block of code to be executed if the condition in the if statement is true.
c) It is used to specify the block of code to be executed if none of the cases match.
d) It is used to specify the block of code to be executed based on the value of an expression.

View Answer
d) It is used to specify the block of code to be executed based on the value of an expression.

31. What is the output of the following code snippet?

int x = 2;
switch (x)
{
case 1:
printf(“One”);
break;
case 2:
printf(“Two”);
break;
default:
printf(“Default”);
break;
}

a) One
b) Two
c) Default
d) Error

View Answer
b) Two

32. What is the purpose of the “break” statement in a switch statement?

a) It terminates the current loop and transfers control to the next iteration.
b) It transfers control to a specified label within the current function.
c) It skips the remaining statements in a loop and continues with the next iteration.
d) It exits the current switch statement and transfers control to the statement after the switch.

View Answer
d) It exits the current switch statement and transfers control to the statement after the switch.

33. What is the output of the following code snippet?

int i = 0;
while (i < 5)
{
printf(“%d”, i);
i++;
}

a) 0 1 2 3 4
b) 1 2 3 4 5
c) 0 1 2 3 4 5
d) 1 2 3 4

View Answer
a) 0 1 2 3 4
Learn With Khurshid

34. What is the purpose of the “do-while” loop in C Language?

a) It is used to execute a block of code repeatedly until a condition is satisfied.
b) It is used to execute a block of code at least once, and then repeatedly until a condition is satisfied.
c) It is used to execute a block of code based on the value of an expression.
d) It is used to execute a block of code based on the value of a variable.

View Answer
b) It is used to execute a block of code at least once, and then repeatedly until a condition is satisfied.

35. What is the output of the following code snippet?

int i = 0;
do
{
printf(“%d”, i);
i++;
} while (i < 5);

a) 0 1 2 3 4
b) 1 2 3 4 5
c) 0 1 2 3 4 5
d) 1 2 3 4

View Answer
a) 0 1 2 3 4

36. What is the purpose of the “for” loop in C Language?

a) It is used to execute a block of code repeatedly until a condition is satisfied.
b) It is used to execute a block of code at least once, and then repeatedly until a condition is satisfied.
c) It is used to execute a block of code based on the value of an expression.
d) It is used to execute a block of code based on the value of a variable.

View Answer
d) It is used to execute a block of code based on the value of a variable.

37. What is the output of the following code snippet?

for (int i = 0; i < 5; i++)
{
printf(“%d”, i);
}

a) 0 1 2 3 4
b) 1 2 3 4 5
c) 0 1 2 3 4 5
d) 1 2 3 4

View Answer
a) 0 1 2 3 4

38. What is the purpose of the “continue” statement in a loop construct?

a) It terminates the current loop and transfers control to the next iteration.
b) It transfers control to a specified label within the current function.
c) It skips the remaining statements in a loop and continues with the next iteration.
d) It exits the current function and returns a value.

View Answer
c) It skips the remaining statements in a loop and continues with the next iteration.

39. What is the output of the following code snippet?

for (int i = 0; i < 5; i++)
{
if (i == 2)
continue;
printf(“%d”, i);
}

a) 0 1 2 3 4
b) 1 2 3 4 5
c) 0 1 3 4
d) 1 3 4

View Answer
c) 0 1 3 4

40. What is the purpose of the “goto” statement in C Language?

a) It terminates the current loop and transfers control to the next iteration.
b) It transfers control to a specified label within the current function.
c) It skips the remaining statements in a loop and continues with the next iteration.
d) It exits the current function and returns a value.

View Answer
b) It transfers control to a specified label within the current function.

41. What is the output of the following code snippet?

for (int i = 0; i < 5; i++)
{
if (i == 2)
goto end;
printf(“%d”, i);
}
end:
printf(“End”);

a) 0 1 2 End
b) 1 2 End
c) 0 1 2 3 4 End
d) 1 3 4 End

View Answer
a) 0 1 2 End

42. What is the purpose of the “typedef” keyword in C Language?

a) It is used to define a new data type.
b) It is used to declare a variable.
c) It is used to define a constant.
d) It is used to include a header file.

View Answer
a) It is used to define a new data type.

43. What is the output of the following code snippet?

typedef int myInt;
myInt x = 5;
printf(“%d”, x);

a) 4
b) 5
c) 6
d) 10

View Answer
b) 5

44. What is the purpose of the “struct” keyword in C Language?

a) It is used to define a new data type.
b) It is used to declare a variable.
c) It is used to define a constant.
d) It is used to include a header file.

View Answer
a) It is used to define a new data type.

45. What is the output of the following code snippet?

struct student
{
char name[20];
int age;
};
struct student s;
s.age = 20;
printf(“%d”, s.age);

a) 10
b) 20
c) 30
d) Error

View Answer
b) 20

46. What is the purpose of the “->” operator in C Language?

a) It is used to access the value at a specific memory address.
b) It is used to perform logical AND operations between two operands.
c) It is used to perform logical OR operations between two operands.
d) It is used to access the members of a structure through a pointer.

View Answer
d) It is used to access the members of a structure through a pointer.

47. What is the output of the following code snippet?

struct student
{
char name[20];
int age;
};
struct student s;
struct student *ptr = &s;
ptr->age = 20;
printf(“%d”, ptr->age);

a) 10
b) 20
c) 30
d) Error

View Answer
b) 20

48. What is the purpose of the “enum” keyword in C Language?

a) It is used to define a new data type.
b) It is used to declare a variable.
c) It is used to define a constant.
d) It is used to include a header file.

View Answer
c) It is used to define a constant.

49. What is the output of the following code snippet?

enum color
{
RED,
GREEN,
BLUE
};
enum color c = BLUE;
printf(“%d”, c);

a) 0
b) 1
c) 2
d) BLUE

View Answer
c) 2

50. What is the purpose of the “sizeof” operator in C Language?

a) It returns the size of a variable or data type in bytes.
b) It returns the address of a variable.
c) It returns the ASCII value of a character.
d) It returns the value of a variable.

View Answer
a) It returns the size of a variable or data type in bytes.

Answer of the MCQ on C: MCQ on C Language with Answers

  1. c) real
  2. b) *
  3. d) 11
  4. b) int array[10];
  5. c) 6
  6. a) To determine the size of objects
  7. b) 10
  8. b) while
  9. a) #define CONSTANT 10
  10. a) 5
  11. a) It terminates the current loop and transfers control to the next iteration.
  12. d) stdio.h
  13. b) 5, 6
  14. a) It terminates the current loop and transfers control to the next iteration.
  15. c) 32
  16. c) It is used to specify the block of code to be executed if the condition in the if statement is false.
  17. a) int *ptr;
  18. a) 2
  19. d) ^^
  20. b) 5
  21. d) It exits the current function and returns a value.
  22. d) char str[6] = “Hello”;
  23. b) 11
  24. a) It performs logical AND operation between two operands.
  25. a) True
  26. b) It performs logical OR operation between two operands.
  27. a) True
  28. a) It negates the value of a variable.
  29. a) True
  30. d) It is used to specify the block of code to be executed based on the value of an expression.
  31. b) Two
  32. d) It exits the current switch statement and transfers control to the statement after the switch.
  33. a) 0 1 2 3 4
  34. b) It is used to execute a block of code at least once, and then repeatedly until a condition is satisfied.
  35. a) 0 1 2 3 4
  36. d) It is used to execute a block of code based on the value of a variable.
  37. a) 0 1 2 3 4
  38. c) It skips the remaining statements in a loop and continues with the next iteration.
  39. c) 0 1 3 4
  40. b) It transfers control to a specified label within the current function.
  41. a) 0 1 2 End
  42. a) It is used to define a new data type.
  43. b) 5
  44. a) It is used to define a new data type.
  45. b) 20
  46. d) It is used to access the members of a structure through a pointer.
  47. b) 20
  48. c) It is used to define a constant.
  49. c) 2
  50. a) It returns the size of a variable or data type in bytes.

Khurshid Anwar

I am a computer science trainer, motivator, blogger, and sports enthusiast. I have 25 years of training experience of Computer Science, Programming language(Java, Python, C, C++ etc).