Additional MCQS: Unit 2

C Programming MCQs

C Language MCQs

1. Which of the following is output statement in C?

  • (a) scanf
  • (b) if
  • (c) printf
  • (d) getch

2. ____ values do not change during program execution.

  • (a) Constants
  • (b) Variable
  • (c) Coefficient
  • (d) None of all

3. Format specifier for int is:

  • (a) %c
  • (b) %i
  • (c) %d
  • (d) b & c both

4. Format specifier for float is:

  • (a) %f
  • (b) %i
  • (c) %d
  • (d) b & c both

5. Format specifier for char is:

  • (a) %c
  • (b) %i
  • (c) %d
  • (d) b & c both

6. Format specifier is used for?

  • (a) variables
  • (b) constants
  • (c) expressions
  • (d) All

7. Which of the following is input statement in C?

  • (a) scanf
  • (b) if
  • (c) printf
  • (d) getch

8. How many inputs can be get using input statement?

  • (a) 2
  • (b) 3
  • (c) 4
  • (d) many

9. Symbol used in scanf is:

  • (a) #
  • (b) &
  • (c) /
  • (d) *

10. getch() is used to get ____ characters

  • (a) 2
  • (b) 1
  • (c) 7
  • (d) 8

11. Statement terminator is represented by:

  • (a) .
  • (b) ^
  • (c) ;
  • (d) %

12. Which escape character can be used to begin a new line in C?

  • (a) \a
  • (b) \n
  • (c) \m
  • (d) \b

13. Which escape character can be used to display ‘

  • (a) \’
  • (b) \n
  • (c) \m
  • (d) \b

14. Which escape character can be used for beep sound

  • (a) \x
  • (b) \a
  • (c) \t
  • (d) \n

15. Which escape character can be used to remove previous character?

  • (a) \a
  • (b) \n
  • (c) \m
  • (d) \b

16. Which escape character is used to move cursor to next tab

  • (a) \x
  • (b) \t
  • (c) \t
  • (d) \n

17. Which escape character can be used to display \

  • (a) \\
  • (b) \~
  • (c) \’
  • (d) \”

18. What will be the output of this code? `void main() { printf(“My name is”); printf(“Adeel Mahboob”); }`

  • (a) My name isAdeel Mahboob
  • (b) My name is
    Adeel Mahboob
  • (c) My name is Adeel Mahboob
  • (d) error

19. How many basic data types available in C?

  • (a) 2
  • (b) 3
  • (c) 4
  • (d) 5

20. Which of the following operator is used to assign value to variable?

  • (a) *
  • (b) =
  • (c) +
  • (d) ==

21. Which operator has the lowest priority?

  • (a) ++
  • (b) %
  • (c) +
  • (d) ||

22. Which operator has the highest priority?

  • (a) ()
  • (b) %
  • (c) +
  • (d) ||

23. Format specifier start with the symbol:

  • (a) ()
  • (b) %
  • (c) +
  • (d) ||

24. Which of the following is wrong?

  • (a) a=b+3;
  • (b) a=c+d;
  • (c) 7=a+b;
  • (d) both a & b

25. printf is used to print ____ type of data.

  • (a) int
  • (b) float
  • (c) char
  • (d) all

26. scanf is a ____ in C programming language.

  • (a) keyword
  • (b) library
  • (c) function
  • (d) none

27. getch() is used to take ____ as input from user.

  • (a) int
  • (b) float
  • (c) char
  • (d) all

28. Let the following part of code, what will be the value of variable a after execution? `int a = 4; float b = 2.2; a = a*b;`

  • (a) 8.8
  • (b) 8
  • (c) 8.0
  • (d) 8.2

29. Which of the following is a valid line of code?

  • (a) int =20;
  • (b) grade = ‘A’;
  • (c) line= this is a line ;
  • (d) none

30. Which operator has highest precedence?

  • (a) /
  • (b) =
  • (c) >
  • (d) !

31. Which of the following is not a type of operator?

  • (a) arithmetic operator
  • (b) relational operator
  • (c) check operator
  • (d) logical operator

32. The operator % is used to calculate:

  • (a) percentage
  • (b) remainder
  • (c) factorial
  • (d) square

33. Which of the following is a valid character?

  • (a) ‘here’
  • (b) “a”
  • (c) ‘9’
  • (d) none

34. What is true about C language?

  • (a) C is not a case sensitive language
  • (b) Keywords can be used as variables
  • (c) All logical operators are binary operator
  • (d) none

35. ____ function has the weakness that we have to press enter key to finish entering.

  • (a) printf()
  • (b) puts()
  • (c) scanf()
  • (d) gets()

36. In the getch() function the gets ____ from a device.

  • (a) Output
  • (b) Input
  • (c) Both a & b
  • (d) None of all

37. In the getch() function the ch means it gets a:

  • (a) File
  • (b) Folder
  • (c) Function
  • (d) Character

38. The getch() function requires header file.

  • (a) stdio.h
  • (b) conio.h
  • (c) math.h
  • (d) string.h

End of MCQ List.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top