5.1.1 - Innrduction to Programming.
1. What is the primary purpose of programming?
- (A) To create music
- (B) To convert problems into executable software
- (C) To design websites
- (D) To enhance computer graphics
Correct Answer: (B) To convert problems into executable software
2. Which of the following is a fundamental concept in computer programming?
- (A) Data
- (B) Graphics
- (C) Networking
- (D) Security
Correct Answer: (A) Data
3. What are the two essential elements of a computer program?
- (A) Sequence of instructions and computer hardware
- (B) Sequence of instructions and computer programming language
- (C) Data structures and algorithms
- (D) User interface and operating system
Correct Answer: (B) Sequence of instructions and computer programming language
4. Who is regarded as the first computer programmer?
- (A) Grace Hopper
- (B) Ada Augusta Lovelace
- (C) Konrad Zuse
- (D) Dennis Ritchie
Correct Answer: (B) Ada Augusta Lovelace
5. What is machine language primarily composed of?
- (A) Text and graphics
- (B) Binary codes (0s and 1s)
- (C) High-level commands
- (D) Assembly language instructions
Correct Answer: (B) Binary codes (0s and 1s)
6. Which programming language was developed for business applications?
- (A) C
- (B) FORTRAN
- (C) COBOL
- (D) BASIC
Correct Answer: (C) COBOL
7. Which of the following keywords are used in a switch statement in C programming?
- (A) switch, if, else
- (B) switch, case, default, break
- (C) for, while, switch
- (D) case, break, if, else
Correct Answer: (B) switch, case, default, break
8. What does the operand section of a machine language instruction specify?
- (A) The action to be performed
- (B) The data to be used for the operation
- (C) The programming language used
- (D) The memory allocation
Correct Answer: (B) The data to be used for the operation
9. What is a significant disadvantage of first-generation programming languages?
- (A) They are easy to understand
- (B) They require translation
- (C) They are difficult to maintain
- (D) They are portable
Correct Answer: (C) They are difficult to maintain
10. Which programming language is known for its use in scientific and numerical analysis?
- (A) COBOL
- (B) FORTRAN
- (C) Pascal
- (D) BASIC
Correct Answer: (B) FORTRAN
11. What does a compiler do?
- (A) Executes code
- (B) Translates high-level code to machine language
- (C) Debugs code
- (D) Creates user interfaces
Correct Answer: (B) Translates high-level code to machine language
12. What type of programming language is Python?
- (A) Low-level language
- (B) High-level language
- (C) Assembly language
- (D) Machine language
Correct Answer: (B) High-level language
13. Which of the following is an example of a high-level programming language?
- (A) C
- (B) Assembly
- (C) Machine Code
- (D) Binary Code
Correct Answer: (A) C
14. What is the main advantage of using a high-level programming language?
- (A) It is machine-dependent
- (B) It is easier for humans to read and write
- (C) It requires more hardware resources
- (D) It runs faster than low-level languages
Correct Answer: (B) It is easier for humans to read and write
15. Which of the following is NOT a characteristic of procedural programming?
- (A) Emphasis on functions
- (B) Focus on data
- (C) Control structures
- (D) Sequential execution
Correct Answer: (B) Focus on data
16. What is the purpose of an Integrated Development Environment (IDE)?
- (A) To create databases
- (B) To facilitate software development with tools
- (C) To design graphics
- (D) To debug hardware
Correct Answer: (B) To facilitate software development with tools
17. What is an algorithm?
- (A) A programming language
- (B) A set of instructions for solving a problem
- (C) A software application
- (D) A computer hardware component
Correct Answer: (B) A set of instructions for solving a problem
18. What is the significance of the 'break' statement in a switch case?
- (A) It terminates the entire program
- (B) It skips the current iteration
- (C) It exits the switch statement
- (D) It restarts the loop
Correct Answer: (C) It exits the switch statement
19. Which of the following is an example of a structured programming language?
- (A) COBOL
- (B) Java
- (C) Assembly
- (D) FORTRAN
Correct Answer: (B) Java
20. What does a debugger do?
- (A) Executes programs
- (B) Analyzes and fixes code errors
- (C) Compiles code
- (D) Designs user interfaces
Correct Answer: (B) Analyzes and fixes code errors
21. Which generation of programming languages includes assembly languages?
- (A) First Generation
- (B) Second Generation
- (C) Third Generation
- (D) Fourth Generation
Correct Answer: (B) Second Generation
22. What software is used to translate assembly language programs into machine language?
- (A) Compiler
- (B) Interpreter
- (C) Assembler
- (D) Debugger
Correct Answer: (C) Assembler
23. Which of the following is a benefit of second-generation programming languages?
- (A) They are machine-independent.
- (B) They are easier to create and understand than first-generation languages.
- (C) They execute faster than machine languages.
- (D) They require no knowledge of CPU architecture.
Correct Answer: (B) They are easier to create and understand than first-generation languages.
24. Which of the following is a drawback of second-generation programming languages?
- (A) They are portable across different machines.
- (B) They execute more slowly than machine languages.
- (C) They require less knowledge of computer architecture.
- (D) They have high productivity.
Correct Answer: (B) They execute more slowly than machine languages.
25. Which programming paradigm is primarily used by third-generation programming languages?
- (A) Object-oriented Programming
- (B) Declarative Programming
- (C) Procedural Programming
- (D) Constraint Programming
Correct Answer: (C) Procedural Programming
26. Which of the following programming languages is considered a third-generation language?
- (A) SQL
- (B) COBOL
- (C) PowerBuilder
- (D) Mercury
Correct Answer: (B) COBOL
27. What is a key characteristic of third-generation programming languages?
- (A) They are domain-specific.
- (B) They use symbolic names instead of mnemonics.
- (C) They are machine-independent.
- (D) They require deep knowledge of CPU architecture.
Correct Answer: (C) They are machine-independent.
28. Which of the following is a benefit of third-generation programming languages?
- (A) They require extensive debugging tools.
- (B) They make it easier to maintain programs.
- (C) They are less intuitive than first-generation languages.
- (D) They are tied to specific machines.
Correct Answer: (B) They make it easier to maintain programs.
29. Which statement accurately describes compilers?
- (A) They execute programs line by line.
- (B) They translate the entire program into machine language before execution.
- (C) They do not produce error messages.
- (D) They are used for low-level programming languages only.
Correct Answer: (B) They translate the entire program into machine language before execution.
30. Which programming languages are categorized as fourth-generation languages?
- (A) COBOL, C, C++
- (B) FORTRAN, BASIC, ALGOL
- (C) SQL, PowerBuilder, XBase++
- (D) Mercury, Prolog, OPS5
Correct Answer: (C) SQL, PowerBuilder, XBase++
31. What is the primary purpose of fourth-generation programming languages (4GLs)?
- (A) To increase coding complexity
- (B) To minimize the cost and time of software development
- (C) To focus on machine-level programming
- (D) To restrict programming to specific domains
Correct Answer: (B) To minimize the cost and time of software development
32. Which characteristic is essential for fourth-generation programming languages?
- (A) They require detailed knowledge of CPU architecture.
- (B) They implement database management systems (DBMS).
- (C) They execute faster than third-generation languages.
- (D) They are only suitable for scientific applications.
Correct Answer: (B) They implement database management systems (DBMS).
33. Which of the following programming languages is associated with the fifth generation of programming languages?
- (A) C/C++
- (B) SQL
- (C) Prolog
- (D) COBOL
Correct Answer: (C) Prolog
34. What is a primary focus of fifth-generation programming languages?
- (A) Developing low-level machine code
- (B) Artificial Intelligence and Neural Networks
- (C) Creating domain-specific applications
- (D) Simplifying assembly language programming
Correct Answer: (B) Artificial Intelligence and Neural Networks
35. Which of the following is a characteristic of a good programming language?
- (A) It should be difficult to learn.
- (B) It must allow programmers to focus on design without extensive background knowledge.
- (C) It must be tied to specific hardware.
- (D) It should have inconsistent syntax and semantics.
Correct Answer: (B) It must allow programmers to focus on design without extensive background knowledge.
36. What should a programming language's function library include?
- (A) Poor documentation
- (B) Inconsistent functions
- (C) Detailed documentation
- (D) Only basic functions
Correct Answer: (C) Detailed documentation
37. Which characteristic improves the efficiency of programs written in a good programming language?
- (A) High memory usage
- (B) Platform dependence
- (C) Efficient use of memory and computer resources
- (D) Complex syntax
Correct Answer: (C) Efficient use of memory and computer resources.
38. Why are fifth-generation programming languages user-friendly?
- (A) They require complex syntax.
- (B) They utilize everyday English vocabulary for communication.
- (C) They focus on low-level programming.
- (D) They require extensive background knowledge.
Correct Answer: (B) They utilize everyday English vocabulary for communication.
39. Which programming languages fall under the fifth generation?
- (A) FORTRAN, COBOL
- (B) Prolog, Lisp
- (C) Java, C#
- (D) C, C++
Correct Answer: (B) Prolog, Lisp
40. Which programming paradigm is commonly used in fifth-generation languages?
- (A) Procedural
- (B) Functional
- (C) Logic-based
- (D) Object-oriented
Correct Answer: (C) Logic-based
5.1.2 - Barief History of C/C++.
41. Who developed the C programming language?
- (A) Bjarne Stroustrup
- (B) Dennis Ritchie
- (C) Ken Thompson
- (D) James Gosling
Correct Answer: (B) Dennis Ritchie
42. What was the primary purpose of creating the C programming language?
- (A) Web development
- (B) Game development
- (C) System programming and UNIX development
- (D) Mobile app development
Correct Answer: (C) System programming and UNIX development
43. C++ was originally known as:
- (A) C with Objects
- (B) C with Classes
- (C) C with Functions
- (D) Object C
Correct Answer: (B) C with Classes
44. Who developed C++?
- (A) Ken Thompson
- (B) Dennis Ritchie
- (C) Bjarne Stroustrup
- (D) James Gosling
Correct Answer: (C) Bjarne Stroustrup
45. In which year was C++ officially renamed from 'C with Classes'?
- (A) 1979
- (B) 1983
- (C) 1985
- (D) 1990
Correct Answer: (B) 1983
46. What does the '++' in C++ signify?
- (A) Decrement operator
- (B) No significance
- (C) Increment operator, symbolizing an improvement over C
- (D) Addition of functions
Correct Answer: (C) Increment operator, symbolizing an improvement over C
47. Which of the following was NOT a feature introduced in early C++?
- (A) Classes
- (B) Inheritance
- (C) Threads
- (D) Default function arguments
Correct Answer: (C) Threads
48. Which book introduced C++ as a commercial product in 1985?
- (A) The Annotated C++ Reference
- (B) The C++ Standard Library
- (C) The C++ Programming Language
- (D) Programming in C++
Correct Answer: (C) The C++ Programming Language
49. The first international standard for C++ was released in:
- (A) 1995
- (B) 1998
- (C) 2003
- (D) 2011
Correct Answer: (B) 1998
50. Which C++ standard included the Standard Template Library (STL)?
- (A) C++98
- (B) C++03
- (C) C++11
- (D) C++20
Correct Answer: (A) C++98
51. Which programming paradigm does C++ support?
- (A) Functional programming only
- (B) Object-oriented programming only
- (C) Both object-oriented and procedural programming
- (D) Procedural programming only
Correct Answer: (C) Both object-oriented and procedural programming
52. Which language influenced the object-oriented features of C++?
- (A) Simula
- (B) Pascal
- (C) FORTRAN
- (D) COBOL
Correct Answer: (A) Simula
53. What was the name of the first C++ compiler?
- (A) GCC
- (B) Turbo C++
- (C) Cfront
- (D) Borland C++
Correct Answer: (C) Cfront
54. C++ is considered a:
- (A) High-level language
- (B) Low-level language
- (C) Middle-level language
- (D) Machine-level language
Correct Answer: (C) Middle-level language
55. Which of the following was NOT a feature of C++11?
- (A) The "auto" keyword
- (B) Variadic templates
- (C) Threads
- (D) Garbage collection
Correct Answer: (D) Garbage collection
56. What is the most recent C++ standard as of 2023?
- (A) C++11
- (B) C++17
- (C) C++20
- (D) C++23
Correct Answer: (D) C++23
57. What is the primary difference between C and C++?
- (A) C++ supports object-oriented programming, while C does not
- (B) C++ is slower than C
- (C) C++ is not backward compatible with C
- (D) C++ lacks pointers, unlike C
Correct Answer: (A) C++ supports object-oriented programming, while C does not
58. The first object-oriented language that influenced C++ was:
- (A) FORTRAN
- (B) Java
- (C) Simula
- (D) Smalltalk
Correct Answer: (C) Simula
59. Which feature allows C++ to support multiple inheritances?
- (A) Operator overloading
- (B) Virtual functions
- (C) Classes
- (D) Inheritance from multiple base classes
Correct Answer: (D) Inheritance from multiple base classes
5.1.3 - C++: Ab Object Orriented Programming Languages.
60. What is an algorithm in computer science?
- (A) A set of data structures
- (B) A sequence of instructions to solve a problem
- (C) A programming paradigm
- (D) A memory location for storing data
Correct Answer: (B) A sequence of instructions to solve a problem
61. What programming paradigm does C++ support?
- (A) Structured programming
- (B) Object-oriented programming
- (C) Both structured and object-oriented programming
- (D) Functional programming
Correct Answer: (C) Both structured and object-oriented programming
62. Which feature of object-oriented programming promotes reusability?
- (A) Polymorphism
- (B) Inheritance
- (C) Abstraction
- (D) Encapsulation
Correct Answer: (B) Inheritance
63. What is a variable in programming?
- (A) A sequence of steps
- (B) A memory location with a name for storing data
- (C) A control structure
- (D) A reusable component in a program
Correct Answer: (B) A memory location with a name for storing data
64. What does a variable’s type indicate?
- (A) The location of memory
- (B) The kind of data it can hold
- (C) The sequence of steps in a program
- (D) The number of operations it can perform
Correct Answer: (B) The kind of data it can hold
65. Which of the following is an example of an object-oriented programming language?
- (A) C
- (B) ALGOL
- (C) COBOL
- (D) JAVA
Correct Answer: (D) JAVA
66. In object-oriented programming, what is a method?
- (A) A module containing data and subroutines
- (B) A step-by-step procedure
- (C) A process for hiding data
- (D) A set of operations detailing how an object responds to a message
Correct Answer: (D) A set of operations detailing how an object responds to a message
67. What is the principle of information hiding in OOP?
- (A) Storing data in a variable
- (B) The sender of a message does not know how the receiver will fulfill the request
- (C) Grouping a sequence of instructions
- (D) Breaking down a problem into smaller problems
Correct Answer: (B) The sender of a message does not know how the receiver will fulfill the request
68. What is procedural programming based on?
- (A) Objects and classes
- (B) Calling procedures
- (C) Encapsulation and inheritance
- (D) Modular design of a program
Correct Answer: (B) Calling procedures
69. Which programming language is an example of a procedural language?
- (A) JAVA
- (B) C++
- (C) PYTHON
- (D) COBOL
Correct Answer: (D) COBOL
70. In OOP, what is an object?
- (A) A group of functions
- (B) A function for controlling memory
- (C) A module containing data and methods
- (D) A reusable component
Correct Answer: (C) A module containing data and methods
71. What is the key difference between procedural programming and object-oriented programming?
- (A) Procedural programming uses objects
- (B) OOP is based on functions, while procedural programming is not
- (C) Procedural programming is based on procedures, OOP is based on objects
- (D) OOP focuses on structured programming
Correct Answer: (C) Procedural programming is based on procedures, OOP is based on objects
72. Which of the following is a feature of object-oriented programming?
- (A) Top-down design
- (B) Bottom-up design
- (C) Information hiding
- (D) Step-by-step procedure
Correct Answer: (C) Information hiding
73. What type of interaction occurs in object-oriented programming?
- (A) Control structures
- (B) Data manipulations
- (C) Message passing between objects
- (D) Sequential flow of processes
Correct Answer: (C) Message passing between objects
74. What is a module in software engineering?
- (A) A memory location
- (B) A reusable program component
- (C) A procedure
- (D) A variable
Correct Answer: (B) A reusable program component
75. What is the main focus of Procedure-Oriented Programming (POP)?
- (A) Objects and classes
- (B) Functions and procedures
- (C) Data security
- (D) Reusability
Correct Answer: (B) Functions and procedures
76. In Object-Oriented Programming (OOP), what is data encapsulation used for?
- (A) To hide data from direct access
- (B) To expose data for easy access
- (C) To minimize code length
- (D) To enhance performance
Correct Answer: (A) To hide data from direct access
77. Which of the following is a characteristic of Object-Oriented Programming (OOP)?
- (A) Global variables are commonly used
- (B) No data hiding mechanisms
- (C) Objects contain both data and methods
- (D) Functions are the only focus
Correct Answer: (C) Objects contain both data and methods
78. In POP, how is data generally handled?
- (A) Data is encapsulated within objects
- (B) Data is kept hidden from functions
- (C) Data is shared among multiple functions
- (D) Data is inherited from other classes
Correct Answer: (C) Data is shared among multiple functions
79. Which programming paradigm allows for inheritance?
- (A) Procedure-Oriented Programming
- (B) Object-Oriented Programming
- (C) Both POP and OOP
- (D) Neither POP nor OOP
Correct Answer: (B) Object-Oriented Programming
80. What is the primary advantage of OOP over POP in terms of code maintenance?
- (A) Functions are easier to write
- (B) Data is global and accessible
- (C) Code is more modular and reusable
- (D) Programs run faster
Correct Answer: (C) Code is more modular and reusable
81. Which of the following is NOT supported by Procedure-Oriented Programming (POP)?
- (A) Data hiding
- (B) Inheritance
- (C) Reusability
- (D) Both A and B
Correct Answer: (D) Both A and B
82. In which programming paradigm do objects communicate through methods?
- (A) Procedure-Oriented Programming
- (B) Object-Oriented Programming
- (C) Modular Programming
- (D) Functional Programming
Correct Answer: (B) Object-Oriented Programming
83. Which of the following best describes inheritance in OOP?
- (A) Functions calling other functions
- (B) Sharing data among global variables
- (C) Creating new classes based on existing ones
- (D) Hiding data from other functions
Correct Answer: (C) Creating new classes based on existing ones
84. Which of the following is a benefit of using OOP over POP?
- (A) Simpler code with no need for data encapsulation
- (B) Easier reusability and scalability of the code
- (C) Higher speed and performance
- (D) Direct manipulation of data without functions
Correct Answer: (B) Easier reusability and scalability of the code
85. In OOP, what is polymorphism used for?
- (A) Using functions in a procedural way
- (B) Operating different objects using the same method or function
- (C) Dividing a program into functions
- (D) Enhancing data security
Correct Answer: (B) Operating different objects using the same method or function
86. Which of the following is a valid example of object-oriented programming?
- (A) Dividing the program into procedures
- (B) Writing separate functions for each task
- (C) Defining classes and objects
- (D) Using global variables to manage data
Correct Answer: (C) Defining classes and objects
87. Which of the following terms is associated with Object-Oriented Programming (OOP)?
- (A) Encapsulation
- (B) Procedure
- (C) Sequence
- (D) None of the above
Correct Answer: (A) Encapsulation
88. Which language is primarily associated with Procedure-Oriented Programming?
- (A) C++
- (B) Java
- (C) Python
- (D) C
Correct Answer: (D) C
89. What is the main drawback of Procedure-Oriented Programming (POP) when compared to Object-Oriented Programming (OOP)?
- (A) Lack of modularity
- (B) No support for functions
- (C) Limited data security and reusability
- (D) Difficulties in using data types
Correct Answer: (C) Limited data security and reusability
90. Which of the following is not an object in Object-Oriented Programming?
- (A) Class
- (B) Function
- (C) Instance
- (D) Method
Correct Answer: (B) Function
91. How does OOP improve reusability compared to POP?
- (A) By using functions
- (B) By allowing inheritance of classes
- (C) By using global variables
- (D) By separating functions and data
Correct Answer: (B) By allowing inheritance of classes
92. In which of the following programming paradigms are functions the primary method of execution?
- (A) Object-Oriented Programming
- (B) Procedure-Oriented Programming
- (C) Functional Programming
- (D) Event-Driven Programming
Correct Answer: (B) Procedure-Oriented Programming
93. What is the relationship between classes and objects in Object-Oriented Programming?
- (A) Objects are instances of classes
- (B) Classes are instances of objects
- (C) Functions define the objects
- (D) Data defines the classes
Correct Answer: (A) Objects are instances of classes
94. In which of the following programming paradigms is data encapsulation used?
- (A) Procedure-Oriented Programming
- (B) Object-Oriented Programming
- (C) Both POP and OOP
- (D) None of the above
Correct Answer: (B) Object-Oriented Programming
5.1.4 - Types of Programming Languages.
95. Which of the following is a commercial programming language designed to handle business-related issues?
- (A) FORTRAN
- (B) COBOL
- (C) C++
- (D) BASIC
Correct Answer: (B) COBOL
96. What type of programming language is FORTRAN primarily categorized as?
- (A) Special-purpose language
- (B) Scientific language
- (C) General-purpose language
- (D) Logic-oriented language
Correct Answer: (B) Scientific language
97. SQL is an example of which category of programming languages?
- (A) General-purpose language
- (B) Scientific language
- (C) Special-purpose language
- (D) Procedure-oriented language
Correct Answer: (C) Special-purpose language
98. Which of the following is a general-purpose programming language?
- (A) COBOL
- (B) C
- (C) SQL
- (D) Prologue
Correct Answer: (B) C
99. Procedure-oriented languages focus more on which aspect?
- (A) Data
- (B) Procedures
- (C) Logic
- (D) Objects
Correct Answer: (B) Procedures
100. Prologue is an example of which type of programming language?
- (A) Procedure-oriented language
- (B) Logic-oriented language
- (C) Object-oriented language
- (D) Machine language
Correct Answer: (B) Logic-oriented language
101. Object-oriented programming languages emphasize which of the following?
- (A) Procedures
- (B) Data
- (C) Objects
- (D) Algorithms
Correct Answer: (C) Objects
102. Machine language is primarily composed of what?
- (A) Mnemonic codes
- (B) Numeric codes
- (C) Logical statements
- (D) English-like notation
Correct Answer: (B) Numeric codes
103. Which programming language was designed for educational purposes and is known for its simplicity?
- (A) BASIC
- (B) C++
- (C) FORTRAN
- (D) Ada
Correct Answer: (A) BASIC
104. What does the acronym SQL stand for?
- (A) Structured Query Language
- (B) Standard Query Language
- (C) System Query Language
- (D) Simple Query Language
Correct Answer: (A) Structured Query Language
105. The language used for scientific computations that introduced control structures is known as:
- (A) C
- (B) ALGOL
- (C) FORTRAN
- (D) COBOL
Correct Answer: (C) FORTRAN
106. What feature is introduced in ALGOL that helps in program construction?
- (A) Object-oriented programming
- (B) Recursive subprograms
- (C) Logic programming
- (D) Data manipulation
Correct Answer: (B) Recursive subprograms
107. Which of the following languages is NOT a high-level programming language?
- (A) C
- (B) BASIC
- (C) Assembly
- (D) Java
Correct Answer: (C) Assembly
108. What was the main goal of the development of BASIC?
- (A) To handle business data
- (B) To simplify programming for beginners
- (C) To perform complex scientific computations
- (D) To create multimedia presentations
Correct Answer: (B) To simplify programming for beginners
109. Which programming paradigm does C++ primarily utilize?
- (A) Procedure-oriented
- (B) Logic-oriented
- (C) Object-oriented
- (D) Functional
Correct Answer: (C) Object-oriented
110. Which of the following is a feature of object-oriented programming?
- (A) Procedural coding
- (B) Information hiding
- (C) Low-level memory management
- (D) None of the above
Correct Answer: (B) Information hiding
111. What programming language introduced the concept of information hiding?
- (A) C++
- (B) Simula
- (C) Java
- (D) Ada
Correct Answer: (B) Simula
112. Which of the following languages was developed by Bjarne Stroustrup?
- (A) C#
- (B) Java
- (C) C++
- (D) Python
Correct Answer: (C) C++
113. C# was conceived by which of the following individuals?
- (A) Bjarne Stroustrup
- (B) Anders Hejlsberg
- (C) Guido van Rossum
- (D) James Gosling
Correct Answer: (B) Anders Hejlsberg
114. Which programming language is primarily used in AI-related applications?
- (A) COBOL
- (B) FORTRAN
- (C) Prolog
- (D) C++
Correct Answer: (C) Prolog
115. Which programming language was designed for the World Wide Web?
- (A) C
- (B) Java
- (C) Ada
- (D) Visual Basic
Correct Answer: (B) Java
116. What is the main purpose of Python as a programming language?
- (A) System programming
- (B) Database management
- (C) Simplicity and readability
- (D) Game development
Correct Answer: (C) Simplicity and readability
117. Which of the following is a characteristic of declarative languages?
- (A) They specify "how" to do something.
- (B) They specify "what" needs to be done.
- (C) They are always procedural.
- (D) None of the above.
Correct Answer: (B) They specify "what" needs to be done.
118. Which language is an example of a logic programming language?
- (A) C++
- (B) Prolog
- (C) Ada
- (D) Python
Correct Answer: (B) Prolog
119. Which programming language is used for document formatting?
- (A) Java
- (B) C++
- (C) TeX
- (D) JavaScript
Correct Answer: (C) TeX
120. Which of the following is a widely used page-description language?
- (A) HTML
- (B) SGML
- (C) PostScript
- (D) XML
Correct Answer: (C) PostScript
121. What does XML stand for?
- (A) Extensible Markup Language
- (B) Extended Markup Language
- (C) Extra Markup Language
- (D) None of the above
Correct Answer: (A) Extensible Markup Language
122. Which factor is NOT mentioned as affecting the choice of a programming language?
- (A) Purpose
- (B) Programmer's experience
- (C) Language popularity
- (D) Development and maintenance ease
Correct Answer: (C) Language popularity
123. Which of the following languages is an example of a functional programming language?
- (A) Perl
- (B) Java
- (C) LISP
- (D) Visual Basic
Correct Answer: (C) LISP
124. What is one of the main purposes of using a scripting language?
- (A) To create complex applications
- (B) To address small programming tasks
- (C) To perform system-level programming
- (D) To manage database transactions
Correct Answer: (B) To address small programming tasks
125. What does IDE stand for?
- (A) Integrated Development Environment
- (B) Integrated Debugging Environment
- (C) Independent Development Environment
- (D) International Development Environment
Correct Answer: (A) Integrated Development Environment
126. What programming language is known for its flexibility in expressing common operations?
- (A) C#
- (B) Python
- (C) Perl
- (D) Java
Correct Answer: (C) Perl
127. Which programming language is used to develop web applications?
- (A) COBOL
- (B) FORTRAN
- (C) JavaScript
- (D) Ada
Correct Answer: (C) JavaScript
128. Which language is often used in conjunction with HTML for web scripting?
- (A) SQL
- (B) Java
- (C) JavaScript
- (D) C++
Correct Answer: (C) JavaScript
129. Which of the following programming languages was initially created for the U.S. Department of Defense?
- (A) C++
- (B) Python
- (C) Ada
- (D) Java
Correct Answer: (C) Ada
130. What type of language is SQL?
- (A) Procedural
- (B) Declarative
- (C) Functional
- (D) Object-oriented
Correct Answer: (B) Declarative
131. Which of the following is an application of Python?
- (A) Web development
- (B) Data analysis
-
- (D) All of the above
Correct Answer: (D) All of the above
5.1.5 - Algorihms and flowchart.
132. What is a computer program?
- (A) A set of instructions written in a programming language
- (B) A collection of hardware components
- (C) A type of algorithm used in programming
- (D) A software application for user interaction
Correct Answer: (A) A set of instructions written in a programming language
133. What is the goal of programming?
- (A) To develop hardware components
- (B) To swiftly and precisely solve issues
- (C) To enhance user interface design
- (D) To create graphical representations
Correct Answer: (B) To swiftly and precisely solve issues
134. What does the law of equifinality state?
- (A) There is only one solution to every problem
- (B) Multiple approaches can lead to the same outcome
- (C) Algorithms must be linear in structure
- (D) Every algorithm must be efficient
Correct Answer: (B) Multiple approaches can lead to the same outcome
135. Which of the following is an example of problem-solving?
- (A) Sending a message using various methods
- (B) Writing a computer program
- (C) Using a calculator for arithmetic
- (D) All of the above
Correct Answer: (D) All of the above
136. What are the two categories of flowcharts?
- (A) Program flowcharts and system flowcharts
- (B) Algorithm flowcharts and process flowcharts
- (C) Input flowcharts and output flowcharts
- (D) Data flowcharts and information flowcharts
Correct Answer: (A) Program flowcharts and system flowcharts
137. What is a flowchart primarily used for?
- (A) To illustrate complex programming logic
- (B) To define hardware requirements
- (C) To manage data storage
- (D) To compile programming languages
Correct Answer: (A) To illustrate complex programming logic
138. Which guideline should be followed when making program flowcharts?
- (A) Use only custom symbols
- (B) Show flow from right to left
- (C) Each symbol should have only one input point and one departure point
- (D) Include multiple labels for decision-making branches
Correct Answer: (C) Each symbol should have only one input point and one departure point
139. What is an algorithm?
- (A) A collection of data
- (B) A series of actions to solve a specific problem
- (C) A type of programming language
- (D) A visual representation of data
Correct Answer: (B) A series of actions to solve a specific problem
140. Which of the following best describes the use of algorithms?
- (A) They are used only in computer science
- (B) They simplify complex problems into manageable parts
- (C) They are always linear and straightforward
- (D) They can only be expressed in programming languages
Correct Answer: (B) They simplify complex problems into manageable parts
141. What is a common use case for algorithms in computing?
- (A) Data storage
- (B) Network design
- (C) Sorting lists of data
- (D) Graphics rendering
Correct Answer: (C) Sorting lists of data
142. Why are algorithms important in programming?
- (A) They reduce the need for hardware
- (B) They provide a systematic approach to problem-solving
- (C) They increase the number of programming languages available
- (D) They are the only way to visualize data
Correct Answer: (B) They provide a systematic approach to problem-solving
143. Which of the following is NOT a method of expressing algorithms?
- (A) Natural language
- (B) Pseudocode
- (C) Flowcharts
- (D) Graphical user interface
Correct Answer: (D) Graphical user interface
144. What do flow lines in a flowchart indicate?
- (A) The type of operation
- (B) The order of operations
- (C) The complexity of the algorithm
- (D) The end of the process
Correct Answer: (B) The order of operations
145. Which symbol in a flowchart typically represents a decision point?
- (A) Rectangle
- (B) Oval
- (C) Diamond
- (D) Parallelogram
Correct Answer: (C) Diamond
146. What is the advantage of using flowcharts?
- (A) They increase coding time
- (B) They simplify programming logic
- (C) They eliminate the need for programming
- (D) They are only useful for large programs
Correct Answer: (B) They simplify programming logic
147. How are algorithms beneficial in terms of efficiency?
- (A) They can only solve small problems
- (B) They provide numerous ways to solve one problem
- (C) They are not applicable in real-world situations
- (D) They increase the amount of time needed to solve problems
Correct Answer: (B) They provide numerous ways to solve one problem
148. What is the primary purpose of a flowchart?
- (A) To complicate the understanding of processes
- (B) To visually represent an algorithm or process
- (C) To provide technical jargon
- (D) To replace programming languages
Correct Answer: (B) To visually represent an algorithm or process
149. Which of the following elements is NOT typically used in a flowchart?
- (A) Symbols
- (B) Arrows
- (C) Text descriptions
- (D) Audio cues
Correct Answer: (D) Audio cues
150. What do the arrows in a flowchart signify?
- (A) The types of data
- (B) The flow direction of the process
- (C) The end of the flowchart
- (D) The start of the program
Correct Answer: (B) The flow direction of the process
151. How can flowcharts be compared to blueprints?
- (A) They are less detailed than blueprints
- (B) Both are used before starting a project
- (C) Flowcharts are only for computer programs
- (D) Blueprints are only for buildings
Correct Answer: (B) Both are used before starting a project
152. In which stage of a project are flowcharts most valuable?
- (A) Final stage of implementation
- (B) Documentation phase
- (C) Initial stages of project planning
- (D) Marketing and presentation phase
Correct Answer: (C) Initial stages of project planning
153. What is one benefit of using flowcharts in communication?
- (A) They make communication more complex
- (B) They simplify the explanation of processes
- (C) They require technical knowledge to understand
- (D) They are only useful for programmers
Correct Answer: (B) They simplify the explanation of processes
154. When can flowcharts help identify areas for improvement?
- (A) When a process is straightforward
- (B) When existing processes are convoluted
- (C) When there are no bottlenecks
- (D) When everyone understands the process
Correct Answer: (B) When existing processes are convoluted
155. What does a flowchart help establish in terms of process boundaries?
- (A) The time taken for the process
- (B) The number of employees involved
- (C) The starting and ending points of the process
- (D) The financial cost of the process
Correct Answer: (C) The starting and ending points of the process
156. How do flowcharts facilitate team communication?
- (A) They complicate discussions
- (B) They provide a shared visual representation
- (C) They replace the need for meetings
- (D) They require no prior knowledge of the process
Correct Answer: (B) They provide a shared visual representation
157. In the cooking rice example, which step is conditional?
- (A) Take the rice to be cooked
- (B) Wash the rice in the water
- (C) IF WATER LEVEL = 1 INCH ABOVE THE RICE
- (D) Distribute the cooked rice
Correct Answer: (C) IF WATER LEVEL = 1 INCH ABOVE THE RICE
158. What type of structure do flowcharts primarily represent?
- (A) Data structures
- (B) Sequence logic structures
- (C) Physical structures
- (D) Financial structures
Correct Answer: (B) Sequence logic structures
159. What do flowcharts help identify in problem-solving scenarios?
- (A) The time required for completion
- (B) The potential causes of issues
- (C) The financial implications of a process
- (D) The technologies needed for implementation
Correct Answer: (B) The potential causes of issues
160. Which of the following is NOT a recommended use for flowcharts?
- (A) Documenting simple processes
- (B) Complicating project planning
- (C) Explaining complex algorithms
- (D) Clarifying current processes
Correct Answer: (B) Complicating project planning
161. What does the algorithm for obtaining the sum of two numbers involve?
- (A) Calculating the difference between numbers
- (B) Multiplying the numbers
- (C) Adding the two numbers together
- (D) Dividing the two numbers
Correct Answer: (C) Adding the two numbers together
5.1.6 - Advantages and Limitations of flow Charts.
162. Which of the following is a key advantage of using flowcharts in C++ programming?
- (A) Increased complexity in large programs
- (B) Visual clarity in representing logic
- (C) Time-consuming to create
- (D) Hard to update
Correct Answer: (B) Visual clarity in representing logic
163. Flowcharts are commonly used in programming to:
- (A) Represent the syntax of the program
- (B) Visually depict the logic of the program
- (C) Replace the need for writing actual code
- (D) Display runtime errors in code
Correct Answer: (B) Visually depict the logic of the program
164. What is a major limitation of flowcharts in C++ programming?
- (A) They simplify large programs effectively
- (B) They require less time to create
- (C) They may become difficult to interpret in large programs
- (D) They eliminate the need for debugging
Correct Answer: (C) They may become difficult to interpret in large programs
165. Flowcharts are most useful for which type of programmers?
- (A) Expert programmers only
- (B) Novice programmers
- (C) Programmers who don't use C++
- (D) Programmers who don't use logic
Correct Answer: (B) Novice programmers
166. Which of the following is NOT an advantage of flowcharts?
- (A) Enhances communication among developers
- (B) Serves as a documentation tool
- (C) Automatically updates with program changes
- (D) Provides visual clarity in program design
Correct Answer: (C) Automatically updates with program changes
167. What is one of the limitations of flowcharts in representing C++ code?
- (A) They represent dynamic program execution
- (B) They fully depict object-oriented features like classes
- (C) They might not show detailed code structures like pointers
- (D) They depict data types and structures effectively
Correct Answer: (C) They might not show detailed code structures like pointers
168. In which situation is a flowchart particularly helpful?
- (A) When code is too simple to need documentation
- (B) In detecting logical errors early
- (C) For replacing code syntax
- (D) For automatically generating C++ code
Correct Answer: (B) In detecting logical errors early
169. One of the primary uses of flowcharts is:
- (A) Simplifying syntax errors
- (B) Visualising the logic of complex programs
- (C) Replacing text-based documentation
- (D) Hiding program errors
Correct Answer: (B) Visualising the logic of complex programs
170. Flowcharts in C++ programming are used for:
- (A) Automatically creating program logic
- (B) Debugging and error identification
- (C) Eliminating all errors in the program
- (D) Replacing variable declarations
Correct Answer: (B) Debugging and error identification
171. What is one advantage of using flowcharts for program documentation?
- (A) They replace the need for code documentation
- (B) They are self-updating
- (C) They provide a visual representation of logic for future reference
- (D) They eliminate the need for team discussions
Correct Answer: (C) They provide a visual representation of logic for future reference
172. How do flowcharts aid in communication within the programming realm?
- (A) By replacing written code
- (B) By providing visual clarity of program logic
- (C) By generating code automatically
- (D) By simplifying the code complexity
Correct Answer: (B) By providing visual clarity of program logic
173. What is a limitation of flowcharts when program logic changes?
- (A) The flowchart updates automatically
- (B) Synchronising the flowchart with the updated logic can be difficult
- (C) Flowcharts reflect all dynamic changes in the code
- (D) They don't need updates when the code changes
Correct Answer: (B) Synchronising the flowchart with the updated logic can be difficult
174. Flowcharts may not be able to represent all aspects of which programming feature?
- (A) Variables
- (B) Loops
- (C) Object-oriented features such as classes and objects
- (D) Conditional statements
Correct Answer: (C) Object-oriented features such as classes and objects
175. Why can flowcharts be time-consuming to create?
- (A) They require automated tools
- (B) They involve representing all the complex logic visually
- (C) They eliminate the need for writing code
- (D) They must include precise C++ code syntax
Correct Answer: (B) They involve representing all the complex logic visually
176. What aspect of C++ programming may not be effectively represented in flowcharts?
- (A) Data flow and variables
- (B) Object-oriented features and pointers
- (C) Loops and conditions
- (D) Input and output functions
Correct Answer: (B) Object-oriented features and pointers
177. What is one reason flowcharts are useful in project documentation?
- (A) They can replace the program code entirely
- (B) They offer a static view of the program's dynamic behaviour
- (C) They serve as visual references of the program's logic
- (D) They eliminate the need for variable declarations
Correct Answer: (C) They serve as visual references of the program's logic
178. Flowcharts can help novice C++ programmers by:
- (A) Removing the need for understanding control flow
- (B) Offering a simplified view of how control flows within a program
- (C) Automatically generating code
- (D) Replacing error debugging tools
Correct Answer: (B) Offering a simplified view of how control flows within a program
179. What can be a consequence of oversimplification in flowcharts?
- (A) Critical program details might be omitted
- (B) Programs run more efficiently
- (C) Flowcharts represent every detail precisely
- (D) They reflect real-time execution of code
Correct Answer: (A) Critical program details might be omitted
180. Flowcharts lack the ability to:
- (A) Provide detailed program design
- (B) Help in program documentation
- (C) Represent dynamic program execution
- (D) Aid in debugging
Correct Answer: (C) Represent dynamic program execution
181. What standardisation benefit do flowcharts provide?
- (A) They can replace written documentation
- (B) They follow universal symbols that are understood by all developers
- (C) They remove the need for code syntax
- (D) They are automatically generated from the code
Correct Answer: (B) They follow universal symbols that are understood by all developers
182. In which scenario might a flowchart become difficult to manage?
- (A) For very large and complex C++ programs
- (B) For simple programs with few conditions
- (C) For novice-level programs
- (D) When the program logic is minimal
Correct Answer: (A) For very large and complex C++ programs
183. Flowcharts are static, meaning they cannot:
- (A) Show loops in program logic
- (B) Display dynamic changes in the program's execution
- (C) Represent decision-making processes
- (D) Illustrate conditions and branching
Correct Answer: (B) Display dynamic changes in the program's execution
184. Which of the following is true about flowcharts in C++?
- (A) They can replace all forms of code
- (B) They must include the exact syntax of the code
- (C) They visually represent the program’s structure but may omit detailed syntax
- (D) They are unnecessary for documentation
Correct Answer: (C) They visually represent the program’s structure but may omit detailed syntax
185. Flowcharts may lead to misinterpretation if:
- (A) They are meticulously designed
- (B) They are not designed with clarity
- (C) They use standardised symbols
- (D) They represent simple programs
Correct Answer: (B) They are not designed with clarity
186. How do flowcharts help in error identification?
- (A) They generate code that eliminates errors
- (B) They visually depict the logic flow, helping to identify errors early
- (C) They remove the need for debugging
- (D) They display code syntax
Correct Answer: (B) They visually depict the logic flow, helping to identify errors early
5.1.7 - Pseudocodes.
187. What is the primary purpose of pseudocode?
- (A) To execute algorithms
- (B) To represent algorithms in a human-readable format
- (C) To compile algorithms into machine code
- (D) To run algorithms faster
Correct Answer: (B) To represent algorithms in a human-readable format
188. Which of the following is a key characteristic of pseudocode?
- (A) It uses exact syntax of programming languages
- (B) It can be executed by a computer
- (C) It uses plain English to describe algorithms
- (D) It is used for web development
Correct Answer: (C) It uses plain English to describe algorithms
189. What makes pseudocode different from real programming code?
- (A) Pseudocode is machine-readable
- (B) Pseudocode can be compiled directly into executable files
- (C) Pseudocode is a simplified representation, focusing on human understanding
- (D) Pseudocode requires specific syntax
Correct Answer: (C) Pseudocode is a simplified representation, focusing on human understanding
190. Which of the following is an advantage of pseudocode?
- (A) It helps in understanding the logic without worrying about syntax
- (B) It is directly executable by the compiler
- (C) It speeds up the execution of code
- (D) It optimizes memory usage
Correct Answer: (A) It helps in understanding the logic without worrying about syntax
191. What is the role of pseudocode in algorithm development?
- (A) To improve the efficiency of an algorithm
- (B) To provide an outline of the algorithm before writing actual code
- (C) To replace real code in production systems
- (D) To be executed as a program
Correct Answer: (B) To provide an outline of the algorithm before writing actual code
192. Which of the following statements about pseudocode is true?
- (A) It can be written in any programming language
- (B) It does not require a strict syntax
- (C) It is only used by experienced programmers
- (D) It cannot be modified once written
Correct Answer: (B) It does not require a strict syntax
193. In the context of algorithm representation, pseudocode is best described as:
- (A) A programming language
- (B) A flowchart
- (C) An informal way to describe an algorithm
- (D) A compiled program
Correct Answer: (C) An informal way to describe an algorithm
194. Which of the following is an example of pseudocode?
- (A) if (x > 0) { return true; }
- (B) If x is greater than 0, return true
- (C) function isPositive(x) { return x > 0; }
- (D) x > 0 ? true : false
Correct Answer: (B) If x is greater than 0, return true
195. What is a disadvantage of pseudocode?
- (A) It cannot be executed by a computer
- (B) It is difficult to understand
- (C) It is too formal
- (D) It is not used in programming
Correct Answer: (A) It cannot be executed by a computer
196. When writing pseudocode, which of the following is typically not necessary?
- (A) Logical flow
- (B) Precise syntax
- (C) Clear instructions
- (D) Step-by-step procedure
Correct Answer: (B) Precise syntax
5.1.8 - Sequesnce Logic.
197. What is the primary purpose of control structures in programming?
- (A) To simplify code
- (B) To manage the sequence of statement execution
- (C) To optimize memory usage
- (D) To increase the speed of execution
Correct Answer: (B) To manage the sequence of statement execution
198. How does sequential control operate in a program?
- (A) It executes statements in random order
- (B) It executes statements in a predetermined sequence
- (C) It requires user input for execution
- (D) It allows for conditional branching
Correct Answer: (B) It executes statements in a predetermined sequence
199. What is an example of a situation where sequential control is essential?
- (A) When checking user credentials
- (B) When obtaining data from the user before processing it
- (C) When creating loops
- (D) When making decisions based on conditions
Correct Answer: (B) When obtaining data from the user before processing it
200. What type of control structure allows for the selective execution of statements?
- (A) Sequential control
- (B) Selection control
- (C) Iteration control
- (D) Event control
Correct Answer: (B) Selection control
201. In programming, what does the term "default mode" refer to?
- (A) A mode that requires user interaction
- (B) Sequential control
- (C) A mode for error handling
- (D) A mode for parallel processing
Correct Answer: (B) Sequential control
202. What is the flow of execution in sequential programming?
- (A) Random access
- (B) One statement follows another in order
- (C) Execution depends on user input
- (D) Execution is based on conditions
Correct Answer: (B) One statement follows another in order
203. Why is the order of statements significant in programming?
- (A) It reduces the amount of code
- (B) It determines the correctness of program execution
- (C) It makes debugging easier
- (D) It enhances performance
Correct Answer: (B) It determines the correctness of program execution
204. What must be considered when designing a program to solve real-world problems?
- (A) Only the coding syntax
- (B) The conditions that dictate the flow of execution
- (C) The choice of programming language
- (D) The amount of data to be processed
Correct Answer: (B) The conditions that dictate the flow of execution
205. Which of the following statements about sequential control is true?
- (A) It requires complex logic
- (B) It is the simplest form of program control
- (C) It can only be used in small programs
- (D) It does not allow for user interaction
Correct Answer: (B) It is the simplest form of program control
206. What is an example of a condition that might require selection control?
- (A) Performing addition of two numbers
- (B) Turning off lights after a certain time
- (C) Displaying a welcome message
- (D) Calculating the average of a set of numbers
Correct Answer: (B) Turning off lights after a certain time
5.1.9 - Selection Logic.
207. What is the primary purpose of selection control in programming?
- (A) To execute statements sequentially
- (B) To optimize memory usage
- (C) To make decisions about program data and execute statements conditionally
- (D) To enhance performance
Correct Answer: (C) To make decisions about program data and execute statements conditionally
208. What happens if a division by zero occurs in a program?
- (A) It automatically assigns a value of zero
- (B) It executes without error
- (C) It causes the program to terminate gracefully
- (D) It produces a run-time error
Correct Answer: (D) It produces a run-time error
209. In a selection control statement, how are decisions typically stated?
- (A) As yes/no questions
- (B) As statements of fact
- (C) As multiple-choice questions
- (D) As mathematical equations
Correct Answer: (A) As yes/no questions
210. What does the diamond shape represent in a flowchart?
- (A) A process step
- (B) A decision point
- (C) A terminal point
- (D) A data input
Correct Answer: (B) A decision point
211. If the answer to a decision in a selection control statement is "yes," what happens?
- (A) The right branch of control is taken
- (B) The program skips to the end
- (C) The left branch of control is taken
- (D) The program terminates
Correct Answer: (C) The left branch of control is taken
212. Which of the following is true about the paths in a selection control statement?
- (A) Both paths must contain the same statements
- (B) One path must always be longer than the other
- (C) Both paths can be empty, but not both can be empty simultaneously
- (D) Both paths must have different outcomes
Correct Answer: (C) Both paths can be empty, but not both can be empty simultaneously
213. What would be an inappropriate use of a selection control statement?
- (A) To have both paths execute the same statements
- (B) To execute different statements based on a condition
- (C) To check for errors before performing operations
- (D) To manage program flow based on user input
Correct Answer: (A) To have both paths execute the same statements
214. What is a possible execution scenario of a selection control statement?
- (A) Either one of the two paths can be executed, but not both
- (B) Both paths execute simultaneously
- (C) The program does not make any decisions
- (D) Only one path is executed, and the other is skipped
Correct Answer: (A) Either one of the two paths can be executed, but not both
215. In the context of selection logic, what is a "condition"?
- (A) A type of loop structure
- (B) A statement that executes without checks
- (C) A specific state of program data that determines the flow of execution
- (D) A method for optimizing code
Correct Answer: (C) A specific state of program data that determines the flow of execution
216. What should happen based on the decision in a selection control statement?
- (A) The next statement executed should depend on the condition's outcome
- (B) The input should always be requested again
- (C) The program should run continuously
- (D) The program should terminate immediately
Correct Answer: (A) The next statement executed should depend on the condition's outcome
5.1.10 - Iteration Logic.
217. What does a loop control statement allow you to do?
- (A) To execute statements only once
- (B) To make decisions in the code
- (C) To repeat one or more statements until a condition becomes true
- (D) To optimize memory usage
Correct Answer: (C) To repeat one or more statements until a condition becomes true
218. Which symbols represent a loop in RAPTOR?
- (A) An ellipse and a diamond
- (B) A rectangle and a circle
- (C) A square and a triangle
- (D) A rectangle and a diamond
Correct Answer: (A) An ellipse and a diamond
219. What happens if the decision expression in a loop evaluates to "no"?
- (A) Control passes back to the loop statement for repetition
- (B) The loop terminates immediately
- (C) The program exits completely
- (D) The next statement is executed once
Correct Answer: (A) Control passes back to the loop statement for repetition
220. How many times is Statement 2 executed in the loop?
- (A) Only once after the loop
- (B) At least once before the decision statement
- (C) Only if the decision is true
- (D) Not executed at all
Correct Answer: (B) At least once before the decision statement
221. What happens when a loop creates an infinite loop?
- (A) The program completes successfully
- (B) The loop never stops repeating until manually stopped
- (C) The program skips to the end
- (D) The variables are reset
Correct Answer: (B) The loop never stops repeating until manually stopped
222. What must happen to avoid creating an infinite loop?
- (A) The loop must execute multiple times
- (B) One or more statements in the loop must change the decision variable
- (C) The loop should always have a fixed number of iterations
- (D) The decision statement must always evaluate to true
Correct Answer: (B) One or more statements in the loop must change the decision variable
223. In nested loops, what can occur within a loop statement?
- (A) Only simple statements
- (B) Another loop statement
- (C) Only decision statements
- (D) Only input/output statements
Correct Answer: (B) Another loop statement
224. What is the role of the decision statement in a loop?
- (A) To always execute before the loop begins
- (B) To determine whether the loop continues or stops
- (C) To print the results of the loop
- (D) To modify the values of the loop variables
Correct Answer: (B) To determine whether the loop continues or stops
225. If Statement 2 in a loop is removed, what effect does it have?
- (A) The loop will still function correctly but will start with the decision statement
- (B) The program will throw an error
- (C) The loop will terminate immediately
- (D) It has no effect on the loop execution
Correct Answer: (A) The loop will still function correctly but will start with the decision statement
226. What guarantees the execution of Statement 2 in a loop?
- (A) It comes before the decision statement
- (B) It is the last statement in the loop
- (C) It is executed only if the loop is entered
- (D) It is the only statement in the loop
Correct Answer: (A) It comes before the decision statement
227. What happens to the program if the decision statement never evaluates to "yes"?
- (A) The program will exit
- (B) An infinite loop occurs
- (C) The loop will terminate
- (D) The program will print an error message
Correct Answer: (B) An infinite loop occurs
228. Which type of loop executes at least once regardless of the condition?
- (A) Do-While loop
- (B) For loop
- (C) While loop
- (D) Infinite loop
Correct Answer: (A) Do-While loop
229. In a loop, what is the purpose of modifying the variables in the decision statement?
- (A) To increase the loop speed
- (B) To ensure the loop eventually terminates
- (C) To skip iterations
- (D) To print variable values
Correct Answer: (B) To ensure the loop eventually terminates
230. What type of control structure is used for iteration?
- (A) Loop control
- (B) Selection control
- (C) Sequential control
- (D) Error control
Correct Answer: (A) Loop control
231. How is a loop terminated in RAPTOR?
- (A) By executing the last statement
- (B) When the decision expression evaluates to "yes"
- (C) By removing the loop statement
- (D) By not executing any statements
Correct Answer: (B) When the decision expression evaluates to "yes"
5.1.11 - Advantages and Disadvantages.
232. What is the primary purpose of control structures in programming?
- (A) To manage hardware resources
- (B) To change how a program is executed
- (C) To store data
- (D) To compile code
Correct Answer: (B) To change how a program is executed
233. Which of the following is NOT a type of control structure?
- (A) Loop
- (B) Branching statement
- (C) Conditional expression
- (D) Data structure
Correct Answer: (D) Data structure
234. What is one of the benefits of using control structures?
- (A) Increases code duplication
- (B) Enhances code organization
- (C) Makes programs less flexible
- (D) Reduces program efficiency
Correct Answer: (B) Enhances code organization
235. What can excessive nesting of control structures lead to?
- (A) Improved performance
- (B) Enhanced readability
- (C) Readability problems
- (D) Simplified logic
Correct Answer: (C) Readability problems
236. What is an example of a looping control structure?
- (A) if-else
- (B) for loop
- (C) switch statement
- (D) try-catch
Correct Answer: (B) for loop
237. Which control structure allows for error handling in programs?
- (A) Loop
- (B) Conditional expression
- (C) Branching statement
- (D) try-catch blocks
Correct Answer: (D) try-catch blocks
238. What occurs if a decision statement in a loop never evaluates to "yes"?
- (A) The program stops
- (B) An infinite loop occurs
- (C) The loop executes once
- (D) The program crashes
Correct Answer: (B) An infinite loop occurs
239. Which characteristic is essential for a good program?
- (A) Inflexibility
- (B) Complexity
- (C) Well-structured
- (D) Obscure documentation
Correct Answer: (C) Well-structured
240. What can poorly designed control structures lead to in a program?
- (A) Higher efficiency
- (B) Increased clarity
- (C) Debugging challenges
- (D) Improved readability
Correct Answer: (C) Debugging challenges
241. What is one disadvantage of using control structures?
- (A) They can improve program flow
- (B) They may introduce logical errors
- (C) They help with error handling
- (D) They support modularity
Correct Answer: (B) They may introduce logical errors
242. Which of the following is NOT a benefit of using control structures?
- (A) Programming flow control
- (B) Increased complexity
- (C) Modularity
- (D) Error handling
Correct Answer: (B) Increased complexity
243. How do control structures affect program efficiency?
- (A) They have no effect
- (B) They can increase efficiency by preventing unnecessary calculations
- (C) They always decrease efficiency
- (D) They make programs more complex
Correct Answer: (B) They can increase efficiency by preventing unnecessary calculations
244. What is one of the drawbacks of using excessive control structures?
- (A) Improved code organization
- (B) Simplified debugging
- (C) Code duplication
- (D) Enhanced modularity
Correct Answer: (C) Code duplication
245. What type of control structure is typically used to repeat a block of code?
- (A) Conditional expression
- (B) Loop
- (C) Branching statement
- (D) Exception handling
Correct Answer: (B) Loop
246. What effect does poor use of control structures have on maintainability?
- (A) Improves maintainability
- (B) Makes maintenance easier
- (C) Leads to maintenance difficulties
- (D) Has no impact on maintenance
Correct Answer: (C) Leads to maintenance difficulties
247. What does the term "modularity" refer to in programming?
- (A) Making code longer
- (B) Breaking complex problems into smaller components
- (C) Eliminating all loops
- (D) Creating complex structures
Correct Answer: (B) Breaking complex problems into smaller components
248. What is the consequence of an infinite loop in a program?
- (A) The program runs faster
- (B) The program will never stop unless manually stopped
- (C) The program terminates normally
- (D) The program runs more efficiently
Correct Answer: (B) The program will never stop unless manually stopped
249. Which programming paradigm emphasizes the use of control structures like loops and conditionals?
- (A) Object-oriented programming
- (B) Functional programming
- (C) Procedural programming
- (D) Logical programming
Correct Answer: (C) Procedural programming