Question 1
What type of programming language is C considered?
- A. Object-oriented
- B. Functional
- C. General-purpose, procedural
- D. Logic-based
- E. C is a markup language
Question 2
What is the entry point of a C program?
- A. start()
- B. begin()
- C. program()
- D. main()
- E. entry()
Question 3
Which header file is required for input and output operations in C?
- A. iostream.h
- B. stdio.h
- C. conio.h
- D. stdlib.h
- E. io.h
Question 4
What is the size of the char data type in C?
- A. 2 bytes
- B. 4 bytes
- C. 8 bytes
- D. 1 byte
- E. Variable depending on the system
Question 5
What is the main difference between the '=' and '==' operators in C?
- A. They are interchangeable
- B. '=' is for comparison, '==' is for assignment
- C. '=' is for assignment, '==' is for comparison
- D. '=' is used for strings, '==' is used for numbers
- E. There is no difference
Question 6
Which type of loop guarantees at least one execution of the loop body?
- A. for loop
- B. while loop
- C. do-while loop
- D. if loop
- E. repeat loop
Question 7
What is the purpose of the `scanf` function in C?
- A. To print output to the console
- B. To read input from the user
- C. To perform mathematical calculations
- D. To define variables
- E. To exit the program
Question 8
How can you swap the values of two variables in C without using a third variable?
- A. Using the swap() function
- B. Using bitwise XOR operator
- C. Using pointer arithmetic
- D. Using addition and subtraction
- E. It's not possible
Question 9
What is the main difference between malloc() and calloc()?
- A. malloc() initializes memory to zero, calloc() does not
- B. calloc() initializes memory to zero, malloc() does not
- C. malloc() is for arrays, calloc() is for single variables
- D. calloc() is faster than malloc()
- E. There is no difference
Question 10
Which function is used to determine the length of a string in C?
- A. stringlength()
- B. len()
- C. strsize()
- D. strlen()
- E. size()
Question 11
What is recursion in C?
- A. A loop that runs indefinitely
- B. A function that calls itself
- C. A variable that stores multiple values
- D. A way to define constants
- E. A function that doesn't return a value
Question 12
What is a prime number?
- A. A number divisible by 2
- B. A number that can only be divided by 1 and itself
- C. A number that is a perfect square
- D. A number that is even
- E. Any integer
Question 13
Which function is used to open a file in C?
- A. fileopen()
- B. openfile()
- C. fopen()
- D. createfile()
- E. open()
Question 14
What does 'undefined behavior' in C mean?
- A. The program will always crash
- B. The behavior is predictable and well-defined
- C. The behavior is unpredictable and not defined by the C standard
- D. The program will run without errors
- E. The program will compile with warnings
Question 15
What is a stack in the context of data structures?
- A. A linear data structure following FIFO principle
- B. A circular data structure
- C. A linear data structure following LIFO principle
- D. A non-linear data structure
- E. A way to store data in the cloud