Programming in C
Multi Choice Question
1. Which of the following is NOT a language evaluation criterion?
A. Readability
B. Writability
C. Portability
D. Syntax highlighting
2. The primary goal of language design is to:
A. Make the language look modern
B. Ensure maximum execution speed
C. Improve programmer productivity
D. Reduce memory usage
3. Which of the following is a procedural programming language?
A. Prolog
B. Lisp
C. C
D. HTML
4. Which implementation method translates the entire program before
execution?
A. Interpreter
B. Compiler
C. Assembler
D. Emulator
5. An IDE (Integrated Development Environment) is an example of:
A. Language translator
B. Programming environment
C. Operating system
D. Debugger only
6. Who developed the C programming language?
A. Bjarne Stroustrup
B. James Gosling
C. Dennis Ritchie
D. Ken Thompson
7. C was developed at:
A. Microsoft
B. Bell Labs
C. IBM
D. MIT
8. Which of the following best describes C?
A. Object-oriented
B. Functional
C. Procedural
D. Declarative
9. The first step in executing a C program is:
A. Linking
B. Compilation
C. Preprocessing
D. Execution
10. Which of the following is a valid variable name in C?
A. 2value
B. value_2
C. value-2
D. value.2
11. Which of the following is a valid constant in C?
A. 3.14f
B. "Hello
C. 'AB'
D. 12,000
12. Which data type is used to store a single character in C?
A. int
B. float
C. char
D. string
13. What is the size of an int on most 32-bit systems?
A. 2 bytes
B. 4 bytes
C. 8 bytes
D. 1 byte
14. Which operator is used to get the remainder in C?
A. /
B. %
C. //
D. &
15. What is the output of printf("%d", 10 > 5);?
A. true
B. false
C. 1
D. 0
16. Which of the following is a relational operator in C?
A. &&
B. ==
C. =
D. ++
17. What is the correct syntax to read an integer in C?
A. scanf("%d", &num);
B. read(num);
C. input(num);
D. gets(num);
18. Which function is used to display output in C?
A. scanf()
B. gets()
C. printf()
D. cin
19. Which of the following is a keyword in C?
A. main
B. return
C. print
D. input
20. What is the default return type of main() in C?
A. void
B. int
C. float
D. char
21. Which of the following is a unary operator in C?
a. ++
22. Which of the following is used to comment a single line in C?
A. // comment
B. /* comment */
C. comment
23. What is the output of printf("%c", 65);?
A. 65
B. A
C. Error
D. a
24. Which of the following is a valid format specifier for float?
A. %d
B. %c
C. %f
D. %s
25. Which of the following is not a valid data type in C?
A. int
B. real
C. float
D. char
26. Which of the following is used to declare a constant in C?
A. #define
B. const
C. both a and b
D. static
27. Which of the following is used to terminate a statement in C?
A. .
B. ,
C. ;
D. :
28. Which of the following is a logical operator in C?
A. &
B. &&
C.
D. %
29. Which of the following is used to take input from the user?
A. printf()
B. scanf()
C. cin
D. gets()
30. Which of the following is used to define a macro?
A. #define
B. macro
C. const
D. typedef
31. Which of the following is used to declare a pointer?
A. int *ptr;
B. int ptr*;
C. *int ptr;
D. ptr int*;
32. Which of the following is used to allocate memory dynamically?
A. malloc()
B. calloc()
C. realloc()
D. all of the above
33. Which of the following is used to free allocated memory?
A. delete
B. free()
C. remove()
D. clear()
34. Which of the following is used to define a structure?
A. struct
B. class
C. object
D. typedef
35. Which of the following is used to define a union?
A. struct
B. union
C. typedef
D. class
36. Which of the following is used to define a function?
A. function
B. def
C. void
D. return
37. Which of the following is used to return a value from a function?
A. return
B. break
C. continue
D. exit
38. Which of the following is used to exit from a loop?
A. break
B. continue
C. return
D. exit
39. Which of the following is used to skip an iteration in a loop?
A. break
B. continue
C. return
D. exit
40. Which of the following is used to define an array?
A. int arr[];
B. int arr;
C. arr int[];
D. array int;
41. Which of the following is used to access array elements?
A. ()
B. {}
C. []
D. <>
42. Which of the following is used to define a string?
A. char str[];
B. string str;
C. str char[];
D. array str;
43. Which of the following is used to compare two strings?
A. strcmp()
B. strcpy()
C. strlen()
D. strcat()
44. Which of the following is used to copy a string?
A. strcmp()
B. strcpy()
C. strlen()
D. strcat()
45. Which of the following is used to find the length of a string?
A. strcmp()
B. strcpy()
C. strlen()
D. strcat()
46. Which of the following is used to concatenate two strings?
A. strcmp()
B. strcpy()
C. strlen()
D. strcat()
47. Which of the following is used to open a file in C?
A. fopen()
B. open()
C. file()
D. create()
48. Which of the following is used to close a file in C?
A. fclose()
B. close()
C. end()
D. stop()
49. Which of the following is used to read from a file?
A. fread()
B. read()
C. input()
D. gets()
50. Which of the following is used to write to a file?
A. fwrite()
B. write()
C. output()
D. puts()
E.
51. What is the primary reason for the popularity of C?
A. Object-oriented features
B. Simplicity and efficiency
C. Built-in graphics support
D. Automatic memory management
Answer: b
52.Who developed the C programming language?
A. Bjarne Stroustrup
B. James Gosling
C. Dennis Ritchie
D. Ken Thompson
Answer: c
53. Which of the following is a correct sample C program entry point?
A. void main()
B. int main()
C. main()
D. program main()
Answer: b
54. What is the correct order of a C program structure?
A. Preprocessor → Functions → Main → Variables
B. Header → Main → Declarations → Statements
C. Documentation → Preprocessor → Main → Functions
D. Preprocessor → Global declarations → main() → Functions
Answer: d
55. What is the first step in executing a C program?
A. Compilation
B. Linking
C. Preprocessing
D. Execution
Answer: c
56. Which of the following is NOT part of the C character set?
A. Alphabets
B. Digits
C. Emojis
D. Special symbols
Answer: c
57. Which of the following is a C token?
A. Keyword
B. Identifier
C. Constant
D. All of the above
Answer: d
58. Which of the following is a valid keyword in C?
A. integer
B. real
C. float
D. number
Answer: c
59.Which of the following is a valid identifier?
A. 2value
B. value_2
C. value-2
D. value.2
Answer: b
60. Which of the following is a constant in C?
A. 3.14
B. "Hello"
C. 'A'
D. All of the above
Answer: d
61. Which of the following is a valid data type in C?
A. real
B. string
C. float
D. number
Answer: c
62. How do you declare a variable in C?
A. int x;
B. x int;
C. declare int x;
D. var x;
Answer: a
63. Which of the following assigns a value to a variable?
A. int x = 5;
B. x := 5;
C. x ← 5;
D. assign x = 5;
Answer: a
64. How do you declare a constant variable in C?
A. const int x = 10;
B. constant int x = 10;
C. define x = 10;
D. static const x = 10;
Answer: a
65. What does the volatile keyword indicate?
A. Variable is constant
B. Variable can be optimized
C. Variable may change unexpectedly
D. Variable is global
Answer: c
66. Which of the following is an arithmetic operator?
A. &&
B. ==
C. =
D. <>
Answer: c
67. Which of the following is a relational operator?
A. =
B. ==
C. &&
D. ++
Answer: b
68. Which of the following is a logical operator?
A. &
B. &&
C. =
D. ++
Answer: b
69. Which of the following is an assignment operator?
A. :=
B. ==
C. =
D. =>
Answer: c
70. What is the result of x++?
A. x is decreased by 1
B. x is increased by 1
C. x is unchanged
D. x becomes 0
Answer: b
71. What is the result of --x?
A. x is increased by 1
B. x is decreased by 1
C. x is unchanged
D. x becomes negative
Answer: b
72. Which of the following is a conditional operator?
A. &&
B. ?:
C. ++
D. ==
Answer: b
73. Which of the following is a bitwise operator?
A. &&
B. --
C. &
D. ==
Answer: c
74. Which of the following is a special operator in C?
A. sizeof
B. ++
C. &&
D. ==
Answer: a
75. What is the result of 5 + 3 * 2?
A. 16
B. 11
C. 10
D. 13
Answer: b
76. Which operator has the highest precedence?
=
&&
Answer: b
77. What is type conversion in C?
Changing variable name
Changing data type
Changing function
Changing operator
Answer: b
Which function is used to calculate square root in C?
sqrt()
power()
root()
sq()
Answer: a
Which header file is required for mathematical functions?
stdio.h
conio.h
math.h
string.h
Answer: c
Which function is used to read a character from input?
getchar()
getch()
scanf()
read()
Answer: a
Which function is used to write a character to output?
putchar()
printf()
write()
puts()
Answer: a
Which function is used for formatted input?
scanf()
gets()
input()
cin
Answer: a
Which function is used for formatted output?
printf()
puts()
display()
write()
Answer: a
What is the format specifier for integer in printf()?
%c
%d
%f
%s
Answer: b
What is the format specifier for float in scanf()?
%d
%c
%f
%s
Answer: c
What is the format specifier for character in printf()?
%d
%c
%f
%s
Answer: b
What is the format specifier for string in scanf()?
%d
%c
%f
%s
Answer: d
Which of the following is used to read a string?
gets()
scanf()
fgets()
All of the above
Answer: d
Which of the following is used to write a string?
puts()
printf()
fputs()
All of the above
Answer: d
What is the output of printf("%d", 10 > 5);?
true
false
0
Answer: c
Which of the following is a valid escape sequence?
\n
/n
\n
n/
Answer: a
What is the output of printf("%c", 65);?
65
Error
Answer: b
Which of the following is used to define a macro?
#define
macro
const
typedef
Answer: a
Which of the following is used to include a header file?
#include
include
import
using
Answer: a
Which of the following is used to terminate a statement?
.
:
Answer: c
Which of the following is used to comment a single line?
//
/* */
--
Answer: a
Which of the following is used to declare a pointer?
int *ptr;
int ptr*;
*int ptr;
ptr int;
Answer: a
Which of the following is used to allocate memory dynamically?
malloc()
calloc()
realloc()
All of the above
Answer: d
Which of the following is used to free memory?
delete
free()
remove()
clear()
Answer: b
50. Which of the following is used to return a value from a function?
return
break
continue
exit
Answer: a