Basic C Programming MCQ Questions and Answers
Basic C Programming MCQ questions with answers help candidates master the fundamentals of C language — one of the most popular programming languages for beginners and interview aspirants. These programming questions and answers focus on syntax, operators, loops, functions, and data handling. Practicing C programming MCQs strengthens logic and helps students perform better in technical assessments by TCS, Infosys, HCL, and other top recruiters. Each question is designed to test conceptual understanding and problem-solving skills, making it ideal for both practice and revision before coding interviews or placement exams.
Basic C Programming MCQ
Showing 10 of
198 questions
41. The program fragment int i = 263; purchar (i);
- prints 263
- prints the ASCII equivalent of 263
- rings the bell
- prints garbage
42. Which of the following comments regarding the reading of a string, using scanf (with %s option) and gets, is true ?
- Both can be used interchangeably
- scanf is delimited by end of line, while gets is not.
- scanf is delimited by blank space, while gets is not.
- none of the above
43. The following statement printf ("%f", 9/5); prints
- 1.8
- 1.0
- 2.0
- none of the above
45. Which of the following are not keywords in C?
- printf
- main
- IF
- none of the above
46. The following program fragment unsigned i = 1; int j = -4; printf("%u", i + j ); prints
- garbage
- -3
- aninteger that changes from machine to machine
- none of the above
47. If the following program fragment (assume negative numbers are stored in 2's complement form) unsigned i = 1; int j = -4 ; printf "%u", i + j) ; prints x, then printf ("%d", 8*sizeof (int)); Outputs an integer that is same as (log in the answer are to the base two)
- an unpredictable value
- 8 * log (x+3)
- log (x+3)
- none of the above
48. The following statements for (i = 3; i < 15; i += 3) {printf ("%d", i); ++i; will result in the printing of
- 3 6 9 12
- 3 6 9 12 15
- 3 7 11
- 3 7 11 15
49. If a = 9, b = 5 and c = 3, then the expression (a - a/b * b%c) > a%b%c evaluates to
- true
- false
- invaid
- 0
50. In a for loop, if the condition is missing, then
- it is assumed to be present and taken to be false
- it is assumed to be present and taken to be true
- It results a syntax error
- execution will be terminated abruptly