Chapter 1 – Introduction to
Programming: 50 Comprehensive
Questions
These questions are based on the content from Chapter 1 of the C++ Programming textbook.
Each includes an answer and a brief explanation.
1. 1. What is a program in computing?
A) A physical component
B) A network tool
C) A set of instructions
D) A database
Answer: C
Explanation: A program is a series of instructions for a computer.
2. 2. Which of the following best describes a compiler?
A) Executes code line by line
B) Stores data
C) Converts high-level code
D) Draws flowcharts
Answer: C
Explanation: A compiler translates code into machine-readable format.
3. 3. What is the purpose of problem-solving in programming?
A) Create UI
B) Avoid hardware errors
C) Define solutions
D) Write documents
Answer: C
Explanation: Problem-solving means building logical solutions to tasks.
4. 4. Which of these is a high-level language?
A) Machine
B) Assembly
C) C++
D) Microcode
Answer: C
Explanation: C++ is designed to be human-readable.
5. 5. What is the first step in problem-solving?
A) Coding
B) Debugging
C) Understanding
D) Documenting
Answer: C
Explanation: You must understand the problem before solving it.
6. 6. Which defines an algorithm?
A) Code
B) Debugging tool
C) Step-by-step logic
D) Diagram
Answer: C
Explanation: An algorithm is a logical sequence.
7. 7. Main difference between compiler and interpreter?
A) Compiler: line-by-line
B) Interpreter: whole code
C) Both same
D) Interpreter is line-by-line
Answer: D
Explanation: Interpreter runs line-by-line; compiler runs all at once.
8. 8. What is machine language?
A) GUI
B) Symbols
C) Binary
D) Instructions
Answer: C
Explanation: Machine language is made up of binary code.
9. 9. What is a flowchart?
A) Text
B) Language
C) Visual logic
D) Optimizer
Answer: C
Explanation: Flowcharts represent steps visually.
10. 10. Role of an editor?
A) Stores binary
B) Translates
C) Edits code
D) Optimizes CPU
Answer: C
Explanation: Editors are used to write code.
11. 11. What is debugging?
A) Writing code
B) Testing output
C) Fixing errors
D) Designing UI
Answer: C
Explanation: Debugging means identifying and correcting errors.
12. 12. Which of the following is NOT a high-level language?
A) Java
B) Python
C) Assembly
D) C++
Answer: C
Explanation: Assembly is low-level.
13. 13. What is the result of successful compilation?
A) Source code
B) Executable
C) Syntax error
D) Debugging
Answer: B
Explanation: Compilation produces machine-level executable.
14. 14. Which of the following is a logical representation tool?
A) Syntax tree
B) Flowchart
C) Compiler
D) Loader
Answer: B
Explanation: Flowcharts show logic.
15. 15. What symbol is used for decision in flowchart?
A) Rectangle
B) Parallelogram
C) Diamond
D) Circle
Answer: C
Explanation: Diamond denotes decisions.
16. 16. A __________ is a set of instructions a computer follows.
Answer: program
Explanation: Programs perform tasks.
17. 17. Tool to convert code into machine code is __________.
Answer: compiler
Explanation: Compiler does full translation.
18. 18. Logical steps to solve a problem are called __________.
Answer: algorithm
Explanation: An algorithm is a procedure.
19. 19. A __________ is a visual logic tool.
Answer: flowchart
Explanation: Flowcharts map out logic visually.
20. 20. __________ language uses 0s and 1s.
Answer: Machine
Explanation: Binary is direct CPU language.
21. 21. __________ is fixing errors in code.
Answer: Debugging
Explanation: Debugging ensures proper function.
22. 22. Code is written in an __________.
Answer: editor
Explanation: Editors help programmers write code.
23. 23. The __________ function starts a C++ program.
Answer: main
Explanation: Execution begins with main().
24. 24. Written code is called __________ code.
Answer: source
Explanation: Source code is what is compiled.
25. 25. __________ languages are easier to read.
Answer: High-level
Explanation: They are closer to natural language.
26. 26. C++ is a high-level language.
Answer: True
Explanation: It’s designed for readability.
27. 27. Compiler runs code line-by-line.
Answer: False
Explanation: Interpreter does that.
28. 28. Algorithms are diagram-based.
Answer: False
Explanation: That’s flowcharts.
29. 29. Machine language is readable.
Answer: False
Explanation: It’s binary.
30. 30. Debugging means writing new code.
Answer: False
Explanation: It means fixing code.
31. 31. First step is coding.
Answer: False
Explanation: Understanding comes first.
32. 32. Flowcharts help plan programs.
Answer: True
Explanation: They show logic visually.
33. 33. Editor is used for coding.
Answer: True
Explanation: It's a workspace for code.
34. 34. High-level languages don’t need compilers.
Answer: False
Explanation: They must be compiled/interpreted.
35. 35. You can write code without knowing the problem.
Answer: False
Explanation: You must understand the problem first.
36. 36. What is an interpreter?
Answer: A tool that executes code line by line.
Explanation: Useful for testing and debugging programs.
37. 37. Give one example of a high-level language.
Answer: C++
Explanation: C++ allows easier, human-readable programming.
38. 38. What is the role of problem definition?
Answer: To understand the task clearly.
Explanation: It helps build the correct solution.
39. 39. What is the object code?
Answer: The machine-level code output by a compiler.
Explanation: It's not yet executable; needs linking.
40. 40. Name a tool used to edit source code.
Answer: Code::Blocks or Notepad++
Explanation: These are code editors.
41. 41. Why is logic important in programming?
Answer: It ensures correct outcomes.
Explanation: Logic drives program behavior.
42. 42. What does the linker do?
Answer: Combines object files into an executable.
Explanation: It's part of the compilation process.
43. 43. What is SDLC?
Answer: Software Development Life Cycle.
Explanation: It describes stages of software development.
44. 44. Why use pseudocode?
Answer: To plan algorithms in plain language.
Explanation: Helps before writing actual code.
45. 45. Why is documentation important?
Answer: It explains how the code works.
Explanation: Helps others understand and maintain it.
46. 46. What is a bug in programming?
Answer: An error or flaw in the program.
Explanation: It causes incorrect program behavior.
47. 47. What happens during testing?
Answer: The program is run to find errors.
Explanation: Essential to ensure reliability.
48. 48. Define execution in programming.
Answer: The process of running a program.
Explanation: Where compiled code is performed.
49. 49. What is meant by portability in programming?
Answer: The ability to run a program on different platforms.
Explanation: High-level languages increase portability.
50. 50. What is machine independence?
Answer: Code written in high-level language works across platforms.
Explanation: Machine code is hardware-specific, but high-level code can be ported.