1 C Flashcards

(30 cards)

1
Q

What is a program?

A

A set of instructions that a computer executes to perform a task.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is C?

A

A general-purpose programming language often used for systems programming and as an introduction to programming in CS50.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a compiler?

A

A program that translates source code into machine code that the computer can execute.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the difference between source code and executable code?

A

Source code is human-readable code written by a programmer; executable code is machine-readable code the computer runs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a variable in C?

A

A named storage location in memory that can hold a value of a specific type.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the basic data types in C?

A

int, float, double, char, and bool (via stdbool.h).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is an int in C?

A

A data type representing whole numbers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a float in C?

A

A data type representing numbers with decimal points (single precision).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a double in C?

A

A data type representing numbers with decimal points (double precision).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is a char in C?

A

A data type representing a single character.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a boolean in C?

A

A data type representing true or false values (via stdbool.h).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a function in C?

A

A reusable block of code that performs a specific task.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is main() in C?

A

The entry point function where execution of a C program begins.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a return value in C?

A

A value a function sends back to the caller to indicate success, failure, or a result.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is printf()?

A

A C standard library function used to print formatted output to the console.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is scanf()?

A

A C standard library function used to read formatted input from the user.

17
Q

What is a constant in C?

A

A value that cannot be changed during program execution (declared with const).

18
Q

What is an array in C?

A

A collection of elements of the same type stored contiguously in memory.

19
Q

What is a pointer in C?

A

A variable that stores the memory address of another variable.

20
Q

What is the difference between stack and heap memory?

A

Stack: memory for local variables with automatic lifetime; Heap: memory allocated dynamically at runtime.

21
Q

What is memory allocation in C?

A

Reserving memory during program execution, usually with malloc() and freed with free().

22
Q

What is segmentation fault?

A

An error that occurs when a program tries to access memory it shouldn’t.

23
Q

What is a comment in C?

A

Text in the code ignored by the compiler, used to explain code (// for single-line, /* */ for multi-line).

24
Q

What is an operator in C?

A

A symbol that performs operations on variables and values (e.g., +, -, *, /, %).

25
What is a conditional statement?
A statement that executes code based on a true/false condition (if, else if, else).
26
What is a loop in C?
A construct that repeatedly executes a block of code (for, while, do-while).
27
What is an algorithm?
A step-by-step procedure for solving a problem.
28
What is pseudocode?
A plain-language description of an algorithm used for planning before coding.
29
What is debugging?
The process of identifying and fixing errors in a program.
30
What is segmentation in memory?
The division of memory into sections for code, data, stack, and heap.