• ¿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 51 páginas
Examen

CS50 Introduction to Computer Science Test Bank | C, Python Programming & Algorithms Questions 2026/2027

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

Strengthen your computer science foundations with this CS50 Algorithms, C, and Python Programming study resource for the 2026/2027 academic year. Designed for students reviewing introductory computer science concepts, this material covers programming fundamentals, algorithm design, problem-solving techniques, and computational thinking. WHAT IS INCLUDED? CS50 computer science review material C programming concepts and questions Python programming fundamentals Algorithms and problem-solving exercises Programming questions and answers Structured topic-based revision content COVERS CORE EXAM TOPICS: Introduction to computer science and computational thinking C programming syntax, variables, and data types Conditional statements and loops Functions, arrays, and memory management Pointers and data structures Python syntax and programming fundamentals Algorithms and computational complexity Searching and sorting algorithms Data structures including arrays, linked lists, stacks, and queues Problem-solving, debugging, and code analysis Ideal for: CS50 students and beginner programmers developing their understanding of C, Python, algorithms, and foundational computer science principles. Disclaimer: This is an independent educational study resource. It is not affiliated with, endorsed by, or sponsored by Harvard University or the CS50 course team.

Vista previa del contenido

CS 50 Harvard Introduction to Computer Science Comprehensive Core
Exam Prep 120+ Algorithm and C Python Programming Solved Questions
2026-2027
CS50: Introduction to Computer Science Prep with Detailed Rationales
*Course Code:* CS50

*Course Name:* Introduction to Computer Science

*Topic:* Algorithms, C, and Python Programming

*Academic Year:* 2026/2027

,Question 1
In C programming, which data type should be used to store a single 8-bit character
code under the ASCII standard?

A) int

B) char

C) float

D) double

*CORRECT ANSWER:* B) char

*RATIONALE:* In C, the char data type is specifically designed to store 8-bit single-
byte values, which maps directly to standard ASCII character codes (values ranging
from 0 to 255 or -128 to 127). An int typically occupies 4 bytes (32 bits), while float and
double represent single-precision and double-precision IEEE 754 floating-point numbers
respectively.

---

Question 2
What is the primary function of the compiler (such as `clang` or `gcc`) in the context of
C programming?

A) Executing code line-by-line at runtime

B) Translating source code into low-level machine code object files

C) Automatically fixing logical and structural syntax errors in code

D) Allocating memory dynamically on the heap during execution

*CORRECT ANSWER:* B) Translating source code into low-level machine code
object files

*RATIONALE:* A compiler converts high-level C human-readable source code into
binary machine code (executable instructions composed of 0s and 1s) prior to
execution. Line-by-line execution is the characteristic of an interpreter (e.g., standard
Python). Compilers report syntax errors but cannot fix them automatically, and dynamic
heap allocation occurs at runtime via functions like `malloc()`.

---

Question 3
Consider the following C code snippet:

```c

,int x = 5;

int y = 2;

float result = x / y;

```

What is the exact value stored in result after execution?

A) 2.5

B) 2.0

C) 2

D) 3.0

*CORRECT ANSWER:* B) 2.0

*RATIONALE:* Because both operands `x` and `y` are of type int, C performs
integer division. The fraction is truncated, yielding an integer result of `2`. This integer
is then implicitly promoted to a float when assigned to `result`, yielding `2.0`. To achieve
`2.5`, explicit casting like `(float)x / y` is required.

---

Question 4
Which operator in C is used to determine the memory size in bytes occupied by a
specific variable or type?

A) `sizeof`

B) `length`

C) `memoryof`

D) `countof`

*CORRECT ANSWER:* A) `sizeof`

*RATIONALE:* The `sizeof` operator is a compile-time operator in C that returns the
total storage size, in bytes, required by an expression or typed specifier (e.g.,
`sizeof(int)` returns 4 on most modern 32/64-bit platforms). `length` and `countof` are not
built-in operators in standard C.

---

, Question 5
What is the exact outcome of evaluating the expression `!(5 > 3 && 2 == 4)` in C boolean
logic?

A) 0 (false)

B) 1 (true)

C) Syntax Error

D) Undefined Behavior

*CORRECT ANSWER:* B) 1 (true)

*RATIONALE:* Evaluating inner expressions: `(5 > 3)` is `1` (true). `(2 == 4)` is `0`
(false). The conjunction `1 && 0` evaluates to `0` (false). Applying the logical NOT
operator `!` to `0` yields 1 (true).

---

Question 6
Which condition describes an infinite loop in C construct logic?

A) A loop whose condition evaluation always returns non-zero (true)

B) A loop that executes exactly $N$ times where $N = 2^{31}-1$

C) A loop missing explicit type conversion on its counter

D) A loop using `break` statements inside nested conditionals

*CORRECT ANSWER:* A) A loop whose condition evaluation always returns non-
zero (true)

*RATIONALE:* In C, non-zero values represent true, while zero represents false. If
a loop conditional statement (e.g., `while (1)`) remains permanently non-zero without
internal terminating directives (`break`, `return`), the loop never satisfies its termination
criteria, causing an infinite loop.

---

Question 7
In CS50's `cs50.h` library, which function is used to safely request a single string input
from the user at command-line runtime?

A) `scanf()`

B) `get_string()`

Información del documento

Subido en
8 de noviembre de 2026
Número de páginas
51
Escrito en
2026/2027
Tipo
Examen
Contiene
Preguntas y respuestas
$12.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.
LECTSTEPHAN
4.8
(249)
Vendido
45
Seguidores
8
Artículos
3205
Última venta
1 semana 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