SECTION 1: Recap of C, C++ & Reference Type Flashcards

(10 cards)

1
Q

What is the programming paradigm of the C language?

A

Procedural / Structural. It breaks programs into smaller modules to reduce complexity.

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

What memory functions does C use for dynamic memory allocation and deallocation?

A

Allocation: malloc() and calloc()

Deallocation: free()

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

Does C support inline functions or function overloading?

A

No, C does not support inline functions, function overloading, or function overriding.

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

Does C have access specifiers like public and private?

A

No. C does not support access specifiers.

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

What are macros in C, and what is _Generic() used for?

A

define INC(x) _Generic((x), long double: INCl, default: INC, float: INCf)(x)

Macros: Preprocessor replacements like #define PI 3.14

_Generic(): Used in C11 for type-specific macros, e.g.:

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

What is a reference variable in C++?

A

It’s an alias for another variable. Must be initialized. Syntax:

Example .
int x = 10;
int& ref = x; // now ref behaves like x

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

Can reference variables in C++ be reseated to another variable?

A

No. Once bound to a variable, a reference cannot be changed to refer to another.

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

Explain “call by reference” using a reference variable.

A

Function receives an alias (reference) to the variable. Changes inside function reflect outside:
void modify(int& x) { x += 5; }
int a = 10; modify(a); // a becomes 15

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

What are the four stages in C++ compilation?

A

Preprocessor (#include, #define, comment removal)

Compiler (generates object code)

Linker (resolves addresses and combines files)

Executable (.exe file is produced)

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