PROGRAMMING IN C IMPORTANT MCQ
UNIT I – INTRODUCTION TO C PROGRAMMING
Q1. C language was developed by:
a) Dennis Ritchie
b) James Gosling
c) Bjarne Stroustrup
d) Ken Thompson
ð Answer: a) Dennis Ritchie
Q2. Which of the following is NOT a feature of C?
a) Portability
b) Structured language
c) Object-oriented programming
d) Rich set of operators
ð Answer: c) Object-oriented programming
Q3. Which of the following is a keyword in C?
a) main
b) for
c) printf
d) scanf
ð Answer: b) for
Q4. The smallest individual unit in a C program is called:
a) Constant
b) Token
c) Operator
d) Variable
ð Answer: b) Token
Q5. Which data type is used to store a single character?
a) int
b) char
c) float
d) double
ð Answer: b) char
Q6. What is the correct order of writing and executing a C program?
a) Link → Compile → Run
b) Compile → Link → Run
c) Run → Compile → Link
d) None of these
ð Answer: b) Compile → Link → Run
---
UNIT II – C LANGUAGE BASICS
Q1. Which of the following is NOT a data type in C?
a) int
b) float
c) double
d) string
ð Answer: d) string
Q2. The operator == in C is used for:
a) Assignment
b) Equality checking
c) Increment
d) Subtraction
ð Answer: b) Equality checking
Q3. Which operator has the highest precedence in C?
a) +
b) *
c) ()
d) =
ð Answer: c) ()
Q4. Type casting in C is done using:
a) ()
b) {}
c) []
d) <>
ð Answer: a) ()
Q5. The correct syntax for input in C is:
a) scanf("%d", a);
b) scanf("%d", &a);
c) scanf("%d");
d) scanf(a, "%d");
ð Answer: b) scanf("%d", &a);
Q6. Which function is used to display output in C?
a) display()
b) show()
c) printf()
d) output()
ð Answer: c) printf()
---
UNIT III – STATEMENTS
Q1. The statement used for multi-way branching in C is:
a) if
b) if–else
c) switch
d) goto
ð Answer: c) switch
Q2. Which statement causes an unconditional jump in C?
a) break
b) continue
c) goto
d) return
ð Answer: c) goto
Q3. The else part of an if–else statement executes when:
a) Condition is true
b) Condition is false
c) Both a and b
d) None
ð Answer: b) Condition is false
Q4. In C, every switch statement must have:
a) default case
b) at least one case
c) break after every case
d) None of the above
ð Answer: b) at least one case
Q5. Which statement is best for decision making with multiple choices?
a) if
b) if–else
c) switch
d) goto
ð Answer: c) switch
Q6. Which of the following is NOT a branching statement?
a) if
b) switch
c) while
d) goto
ð Answer: c) while
---
UNIT IV – ARRAYS AND STRINGS
Q1. Array elements are always stored in:
a) Random locations
b) Contiguous memory locations
c) Registers
d) Heap only
ð Answer: b) Contiguous memory locations
Q2. The valid declaration of an array in C is:
a) int arr(5);
b) int arr[5];
c) arr int[5];
d) int arr;
ð Answer: b) int arr[5];
Q3. Which string function is used to find the length of a string?
a) strlen()
b) strcpy()
c) strcat()
d) strcmp()
ð Answer: a) strlen()
Q4. To copy one string into another we use:
a) strcat()
b) strcpy()
c) strcmp()
d) strrev()
ð Answer: b) strcpy()
Q5. The array index in C starts from:
a) 0
b) 1
c) -1
d) Any value
ð Answer: a) 0
Q6. The function strrev("C") will return:
a) "C"
b) "CC"
c) "C" reversed
d) Error
ð Answer: a) "C"
---
UNIT V – FUNCTIONS AND STRUCTURES
Q1. Which of the following is a built-in math function in C?
a) add()
b) pow()
c) max()
d) square()
ð Answer: b) pow()
Q2. The function sqrt(25) will return:
a) 5
b) 25
c) 12.5
d) Error
ð Answer: a) 5
Q3. A user-defined function must be:
a) Declared
b) Defined
c) Called
d) All of these
ð Answer: d) All of these
Q4. A group of different data items under a single name in C is called:
a) Array
b) Structure
c) Function
d) Union
ð Answer: b) Structure
Q5. The correct function call syntax is:
a) func;
b) func[];
c) func();
d) call func;
ð Answer: c) func();
Q6. Which keyword is used to define a structure in C?
a) struct
b) str
ucture
c) record
d) define
ð Answer: a) struct