Intensive Programming Final

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/43

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

44 Terms

1
New cards

= assigns; == compares

What is the difference between = and == in C?

2
New cards

Declaration tells the compiler the type; definition allocates storage

What is a declaration vs definition?

3
New cards

Value cannot be modified through that identifier

What does const mean?

4
New cards

Variable keeps its value between calls

What does static mean inside a function?

5
New cards

Visible only in that file (internal linkage)

What does static mean at global scope?

6
New cards

A variable that stores a memory address

What is a pointer?

7
New cards

& gets address; * dereferences.

What do & and * mean?

8
New cards

Adding 1 moves by the size of the pointed-to type.

Pointer arithmetic rule?

9
New cards

Indicates "no valid address."

Null pointer purpose?

10
New cards

char * is a pointer; char[] is a fixed array. Arrays cannot be reassigned.

Difference between char *s and char s[]?

11
New cards

void* pointing to allocated memory; NULL on failure.

What does malloc return?

12
New cards

Portable across systems.

Why use sizeof(type) instead of a number?

13
New cards

Memory leak.

What happens if you forget free?

14
New cards

Pointer to freed memory.

What is a dangling pointer?

15
New cards

No bounds checking — can overflow buffer

Why is strcpy dangerous?

16
New cards

Measures visible characters only.

Why strlen(s) doesn't count '\0'?

17
New cards

Compiler inserts bytes to align fields for performance.

What is padding?

18
New cards

ptr->field

How to access struct members through a pointer?

19
New cards

fopen = buffered stdio; open = low-level system call.

Difference between fopen and open?

20
New cards

Number of bytes read or 0 (EOF) or -1 (error).

What does read() return?

21
New cards

No formatting overhead.

Why is system call I/O faster for large files?

22
New cards

Moves file offset (random access).

What does lseek do?

23
New cards

0 to child, child's PID to parent, -1 on error.

What does fork() return?

24
New cards

Two — parent and child.

After fork(), how many processes run?

25
New cards

Child receives a copy of the parent's address space (copy-on-write).

Why is code duplicated after fork()?

26
New cards

Parent waits for specific child to finish.

What does waitpid(pid, &status, 0) do?

27
New cards

WEXITSTATUS(status).

How to get child’s exit code?

28
New cards

Replaces current process image with a new program

What does exec() do?

29
New cards

Nothing returns — the original code is gone.

What happens after successful exec()?

30
New cards

Child starts a new program.

Why call exec() after fork()?

31
New cards

Asynchronous notification to a process

What is a signal?

32
New cards

Terminate program

Default SIGINT behavior?

33
New cards

More reliable; portable; supports flags (like SA_RESTART).

Why use sigaction instead of signal?

34
New cards

Function automatically called when signal arrives

What is a signal handler?

35
New cards

Must only use async-safe functions (e.g., write, not printf).

Restrictions in signal handlers?

36
New cards

text, data, stack, heap

What are the 4 main memory sections?

37
New cards

Stack

What grows downward?

38
New cards

Heap

What grows upward?

39
New cards

Data (initialized) or BSS (uninitialized)

Where are globals stored?

40
New cards
41
New cards
42
New cards
43
New cards
44
New cards