1.
What command do you use to output data to the screen?
Correct Answer
C. Cout
Explanation
The correct answer is "cout". In C++, "cout" is the standard output stream object that is used to display output on the screen. It is commonly used with the insertion operator "
2.
A Syntax Error is?
Correct Answer
C. An error caused by language rules being broken.
Explanation
A Syntax Error is an error caused by language rules being broken. Syntax refers to the structure and grammar of a programming language, and a syntax error occurs when the code does not follow the correct syntax specified by the language. This could be a missing semicolon, a misplaced bracket, or any other violation of the language's rules. These errors are usually detected by the compiler or interpreter and need to be fixed before the program can be executed.
3.
Which data structure uses LIFO?
Correct Answer
C. Stacks
Explanation
Stacks use the LIFO (Last-In-First-Out) principle, meaning that the last element added to the stack is the first one to be removed. This is similar to a stack of plates, where the topmost plate is the first one to be taken off. Stacks are commonly used in programming and computer science for tasks such as function calls, expression evaluation, and backtracking algorithms.
4.
What is FIFO?
Correct Answer
C. First In First Out
Explanation
FIFO stands for First In First Out. It is a method used to manage and control the flow of items or data in a system. In this system, the first item or data that enters the system is the first one to be processed or used, while the newer items or data are processed or used later. This ensures that the items or data are handled in the order they arrived, similar to a queue.
5.
A memory location that holds a single letter or number.
Correct Answer
C. Char
Explanation
A memory location that holds a single letter or number is referred to as a "char" data type. The "char" data type is used to store individual characters, such as letters or numbers, in computer memory. It occupies a small amount of memory, typically one byte, and can store a wide range of characters, including alphabets, digits, and special symbols.
6.
A do-while and a while loop are the same.
Correct Answer
B. False
Explanation
A do-while loop and a while loop are not the same. The main difference between them is that a do-while loop will always execute its code block at least once, regardless of the condition being true or false. On the other hand, a while loop will only execute its code block if the condition is initially true.
7.
A short section of code written to complete a task.
Correct Answer
C. Function
Explanation
A function is a short section of code written to complete a task. It is a reusable block of code that can be called multiple times within a program to perform a specific action or calculation. Functions help in organizing code and making it more modular, as they can be defined once and used whenever needed. They can also accept input parameters and return output values, making them versatile and flexible for various programming tasks.
8.
Int holds decimals numbers.
Correct Answer
B. False
Explanation
The statement is incorrect. Integers (int) do not hold decimal numbers. Integers are used to store whole numbers without any decimal places. To store decimal numbers, we use data types like float or double. Therefore, the correct answer is False.
9.
One loop inside the body of another loop is called
Correct Answer
B. Nested
Explanation
A loop inside the body of another loop is called nested. This term is used to describe the situation where one loop is placed inside another loop. The inner loop will execute its set of statements for each iteration of the outer loop. This nesting of loops allows for more complex and intricate control flow, as it allows for repetitive actions to be performed multiple times within another repetitive action.
10.
What does this equation mean?
a != t
Correct Answer
C. A is not equal to t
Explanation
The equation "a != t" means that a is not equal to t. This is indicated by the "!=" symbol, which is used to represent "not equal to" in many programming languages. Therefore, the correct answer is "a is not equal to t."