• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 4 fuera de 32 páginas
Examen

CPP PRACTICE EXAM STUDY GUIDE 2026 COMPLETE QUESTIONS WITH CORRECT DETAILED ANSWERS || 100% GUARANTEED PASS RECENT VERSION

Document preview thumbnail
Vista previa 4 fuera de 32 páginas

CPP PRACTICE EXAM STUDY GUIDE 2026 COMPLETE QUESTIONS WITH CORRECT DETAILED ANSWERS || 100% GUARANTEED PASS RECENT VERSION

Vista previa del contenido

CPP PRACTICE EXAM STUDY GUIDE 2026
COMPLETE QUESTIONS WITH CORRECT
DETAILED ANSWERS || 100% GUARANTEED
PASS <RECENT VERSION>
1. What is the correct way to initialize an integer with a value of 10 in modern
C++?
A) int x = 10;
B) int x(10);
C) int x {10};
D) All of the above
Answer: While A and B are valid, C (int x {10};) uses uniform initialization
(brace-initialization) which is preferred in modern C++ because it prevents
narrowing conversions (e.g., trying to initialize an int with a double would cause
an error).


2. Which of the following is NOT a fundamental C++ data type?
A) float
B) string
C) bool
D) wchar_t
Answer: string is not a fundamental type; it is a class template from the Standard
Library (std::string). The fundamental types are also known as built-in types
(e.g., int, char, float, bool).


3. What is the output of std::cout << ;?
A) 2.5
B) 2
C) 3
D) Compilation error

,Answer: When both operands of the division operator are integers, integer division
is performed, and the fractional part is truncated. The result is 2.


4. What does the const keyword imply when applied to a variable?
A) The variable's value is computed at compile time.
B) The variable's value cannot be changed after initialization.
C) The variable is stored in read-only memory.
D) The variable is only accessible within its file.
Answer: The primary meaning of const is that the object is immutable; its value
cannot be modified after it is initialized.


5. Which operator is used to get the memory address of a variable?
A) *
B) &
C) ->
D) ::
Answer: The address-of operator & returns the memory address of its operand.


6. What is the scope resolution operator used for?
A) To define a class.
B) To access a global variable when a local variable with the same name exists.
C) To resolve naming conflicts between different headers.
D) To create a namespace.
Answer: The scope resolution operator :: is used to access a name in the global
scope or a specific namespace from within a scope where that name is hidden by a
local declaration.


7. Which of the following is a valid identifier?
A) my-var

,B) 2nd_value
C) _myVar
D) namespace
Answer: Identifiers must start with a letter or underscore, and contain only letters,
digits, or underscores. Keywords like namespace are invalid.


8. What is the difference between ++i and i++?
A) ++i increments the value before its use (pre-increment), while i++ increments
after its use (post-increment).
B) ++i is only valid for integers.
C) There is no difference.
D) i++ is faster in all scenarios.
Answer: Pre-increment (++i) increments and then returns the new value. Post-
increment (i++) returns the original value and then increments. Pre-increment is
generally more efficient, especially for iterators.


9. What is the purpose of the #include directive?
A) To link a library.
B) To include the contents of a source file.
C) To include the contents of a header file.
D) To define a macro.
Answer: The #include directive is a preprocessor command that literally copies the
contents of the specified header file into the current file before compilation.


10. Which data type is typically used to store a single character?
A) string
B) char
C) wchar
D) byte

, Answer: The char type is designed to store a single character.


11. What is the size (in bytes) of an int on a typical 64-bit system?
A) 2
B) 4
C) 8
D) It is compiler-dependent.
Answer: While the C++ standard only specifies minimum sizes, on most modern
64-bit systems, an int is 4 bytes.


12. Which loop is guaranteed to execute at least once?
A) for loop
B) while loop
C) do-while loop
D) Range-based for loop
Answer: The do-while loop checks its termination condition at the end of the loop
body, so the body is always executed at least once.


13. What is the keyword auto used for in modern C++?
A) To declare a variable with automatic storage duration.
B) To automatically manage memory.
C) For type inference, where the compiler deduces the variable's type.
D) To create a generic function.
Answer: In modern C++ (C++11 and later), auto instructs the compiler to deduce
the type of the variable from its initializer.


14. What is the output? std::cout << (10 > 9 > 8);
A) 1
B) 0

Información del documento

Subido en
3 de noviembre de 2025
Número de páginas
32
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas
$11.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
TrustedExaminer
4.0
(9)
Vendido
90
Seguidores
4
Artículos
3808
Última venta
2 semanas hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes