2.1 - Introduction to C Programming.


Back Button Home

2.1.1 - Introduction to C.


1. What is a primary feature of the C programming language?
Correct Answer: C) General-purpose and flexible
2. C is often referred to as a "middle-level" language because it combines elements of:
Correct Answer: A) High-level language and assembly language
3. Which of the following is NOT a feature of the C programming language?
Correct Answer: B) Complex syntax
4. In C programming, which file type contains the source code of the program?
Correct Answer: C) Source file
5. What is the role of a header file in C programming?
Correct Answer: B) Contains macro definitions and function declarations
6. Which file extension is used for an object file in C programming?
Correct Answer: C) .o
7. What does an executable file in C programming represent?
Correct Answer: B) The linked and compiled binary code
8. Which step comes immediately after writing a C program in a text editor?
Correct Answer: C) Compilation
9. What is the purpose of flowcharts in programming?
Correct Answer: B) To provide a pictorial representation of algorithms
10. What is NOT one of the essential features of an algorithm?
Correct Answer: C) Complexity
11. Which year was the first version of C released?
Correct Answer: B) 1972
12. What was the name of the first book published on C programming in 1978?
Correct Answer: A) "The C Programming Language"
13. Which organization standardized C in 1983?
Correct Answer: B) ANSI
14. In which year were new features like type checking and memory management included in the ISO C standard?
Correct Answer: C) 1999
15. What is the main advantage of C being a "platform-independent" language?
Correct Answer: B) It can run on any hardware and operating system

2.1.2 - Basic Structure of C Programming.


16. What is the purpose of the documentation section in a C program?
Correct Answer: B) To include comments and descriptions about the program
17. Which symbol is used to start a multi-line comment in C?
Correct Answer: B) /*
18. What does the #include statement do in a C program?
Correct Answer: B) It includes the standard input-output library
19. What is a header file in C?
Correct Answer: B) A file with function declarations and macros
20. What does the #define directive do in a C program?
Correct Answer: B) It defines a macro or constant value
21. Which part of the C program is executed first?
Correct Answer: C) Main function
22. In C, what are global variables?
Correct Answer: B) Variables declared outside all functions and accessible throughout the program
23. What is the correct way to start the main function in C?
Correct Answer: D) int main()
24. Why are variables declared at the beginning of a function in C?
Correct Answer: B) To ensure variables are declared before they are used
25. What is the body of a function in C?
Correct Answer: D) The section where the actual operations and logic of the function are implemented
26. Which function is used to print output in C?
Correct Answer: C) printf()
27. What does the return statement in C do?
Correct Answer: C) It returns a value from a function
28. Which of the following is NOT a standard C header file?
Correct Answer: C) stdvec.h
29. What is the correct syntax for defining a constant named PI with a value of 3.14 in C?
Correct Answer: B) #define PI 3.14
30. In a C program, what does int a = 100; do?
Correct Answer: C) It declares an integer variable a and initializes it to 100
31. Which of the following statements about the main function is true?
Correct Answer: A) Every C program must have a main function
32. What is the use of the printf() function?
Correct Answer: B) To display output to the user
33. Which operator is used to access the address of a variable in C?
Correct Answer: B) &
34. Which of the following is a correct way to end a C program?
Correct Answer: B) return 0;
35. What is the result of the expression 5 + 3 * 2 in C?
Correct Answer: B) 11