Which part of a C++ program defines its entry-point function?
01 C++ Fundamentals and Program Structure Online Quiz Questions
Use this free practice quiz with 20 questions to review 01 C++ Fundamentals and Program Structure, test your knowledge, and prepare for your next test or exam.
True or false: C++ comments are ignored during translation.
- A
True
- B
False
What is the technical term for the source produced after an included file's contents are conceptually incorporated and prepared for compilation?
The build stage that handles directives such as #include before ordinary compilation is called .
Which operator is used in std::cin >> age; to read formatted input into age?
- A
<< - B
= - C
>> - D
>
True or false: When placed between valid tokens, spaces, tabs, and line breaks generally do not change a C++ program's meaning.
- A
True
- B
False
Which of the following are standard streams provided by the <iostream> header? Select all correct choices.
- A
std::cout - B
std::cin - C
std::cerr - D
std::clog - E
std::fstream
In the example program, if year is entered as 2000 and current_year is 2026, what integer value is stored in approximate_age?
A typical build proceeds from preprocessing to , which generates lower-level code, and then to , which combines object files and libraries into an executable.
What happens when the command g++ -c greeting.cpp -o greeting.o is used?
- A
It runs the executable after building it.
- B
It stops after compilation and does not link.
- C
It preprocesses only and produces no object file.
- D
It enables line-by-line debugging.
Which choices are lexically valid programmer-defined identifiers in C++? Select all correct choices.
- A
item_count - B
2value - C
Value2 - D
class - E
_temporary
Why can std::getline(std::cin, line) appear to read an empty line immediately after std::cin >> number, and how does std::getline(std::cin >> std::ws, line) address the problem?
Which statement correctly distinguishes the literals "C++" and 'A'?
- A
'C++'is a character literal containing several characters. - B
"C++"is a character literal and'A'is a string literal. - C
"C++"is a string literal and'A'is a character literal. - D
Both forms are interchangeable representations of the same literal type.
A build command processes #include <iostream> before the compiler generates object code. Which build stage handles this directive?
- A
Compilation
- B
Preprocessing
- C
Linking
- D
Execution
A program reads an integer with std::cin >> number and then must read a complete line into line, including spaces. Which approach correctly avoids having std::getline consume the leftover newline?
- A
Call
std::getlinetwice - B
Replace
std::getlinewithstd::cin >> line - C
Use
std::getline(std::cin >> std::ws, line) - D
Add a second integer variable before reading the line
A source file includes a header, and the included contents are incorporated before ordinary compilation. What is the resulting source being processed conceptually called?
- A
translation unit
- B
Only the original
.cppfile before preprocessing - C
The final executable after linking
- D
Only the header file by itself
Which combination correctly sends the text Ready and the value of count to standard output in one statement?
- A
std::cinwith>> - B
std::cerrwith<< - C
std::coutwith>> - D
std::coutwith<<
True or false: A C++ block comment can span several lines, and the comment itself is ignored during translation.
- A
True
- B
False
In C++, what operator inserts a value into an output stream such as std::cout?
A program uses the formula approximate_age = current_year - year with current_year = 2026. If approximate_age is 17, what birth year does the program infer?
Related study packs and tools
2 Digital Logic
A 14-question medium-difficulty quiz on Boolean algebra, logic gates, truth tables, and combinational circuits.
03 — Python Programming Fundamentals
A focused set of flashcards covering Python variables, data types, expressions, control flow, functions, input, output, and common programming practices.
04 Conditionals and Boolean Logic
Learn how Boolean expressions, logical operators, and conditional structures let programs make reliable decisions, including how to handle boundaries, branch order, and testing.
6 Computer Memory
Learn how computer memory stores and addresses information, how RAM and ROM differ, and how caches and the memory hierarchy balance speed, capacity, and cost.
07 Trees and Binary Search Trees
A progressive guide to tree structure, binary-tree traversals, binary search tree operations, deletion, balancing, and the way tree height determines time and space costs.
12 — Foundations Capstone: Integrating Computer Science
A practical guide to integrating problem definition, data representation, modular programming, algorithms, complexity analysis, testing, correctness, and ethical evaluation into a responsible computer science capstone.
Interrupts
Reviews how interrupts support event handling and multitasking, and how Linux system calls use the RISC-V `ecall` instruction and register conventions.
OS Processes
This quiz covers process management, context switching and scheduling, multitasking, traps and interrupts, and RISC-V privilege transitions.
Systemcalls
A quiz on operating-system system calls, including privileged-operation requests, process creation and execution with fork, exec, and waitpid, and signal handling.