Basics of C Programming Flashcards

(40 cards)

1
Q

What does the term ‘imperative’ describe in programming?

A

Describes computation in terms of statements that change a program state.

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

What is the opposite of imperative programming?

A

Declarative programming.

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

What are the two main programming paradigms associated with C?

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

Is C a compiled or interpreted language?

A

Compiled.

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

What type of typing does C use?

A

Statically, weakly typed.

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

What does it mean for C to be statically typed?

A

Types are checked before runtime.

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

What does weakly typed mean in the context of C?

A

Supports implicit type conversions.

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

On what platforms is C available?

A

Pretty much every platform.

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

What is a key characteristic of C regarding portability?

A

Very fast.

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

What feature does C provide for memory management?

A

Explicit memory management.

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

What standards does C adhere to?

A

ANSI/ISO standards.

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

True or False: C has runtime error checking.

A

False.

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

What type of error handling is lacking in C?

A

Sophisticated exception handling.

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

What does GNU stand for?

A

GNU stands for ‘GNU’s Not Unix’.

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

What types of software packages does the GNU system include?

A
  • Compilers
  • Libraries
  • Tools
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is GCC?

A

GNU Compiler Collection, a compiler for multiple languages (C, C++, Java, etc.).

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

What command is used to compile a C program with GCC?

A

gcc myProgram.c

18
Q

What is the default name of the executable file created by GCC?

19
Q

How can you run the compiled program in Linux?

20
Q

How can you specify a custom output file name when compiling with GCC?

A

Use -o: e.g., gcc myProgram.c -o myProgram

21
Q

What is the purpose of compiling to an object file?

A

Object files are portable and allow linking without source code.

22
Q

What command is used to compile a C program into an object file?

A

gcc -c myProgram.c -o myProgram.o

23
Q

What command is used to link an object file and create an executable?

A

gcc myProgram.o -o myProgram

24
Q

Command to compile multiple source files at once?

A

gcc circle.c radius.c -o circle -lm

25
What does the -lm option do when compiling?
Links the math library.
26
First step in compiling multiple files separately before linking?
Compile each file separately with gcc -c.
27
Command to link object files after separate compilation?
gcc circle.o radius.o -o circle -lm
28
How to solve the 'sqrt not defined' error?
Link the math library using -lm.
29
How to solve the error 'radius.o not found'?
Ensure all .o files are correctly compiled.
30
What does K&R C refer to?
Original C version by Kernighan & Ritchie.
31
What is ANSI C?
The first standardized C version (C89/C90).
32
Which C version was introduced in 1999?
C99.
33
What is the latest update of C as of 2011?
C11.
34
What is Embedded C?
Version for small systems/microcontrollers.
35
What integer value indicates success in C programs?
0.
36
What integer value indicates failure/error in C?
Any other number.
37
When a C program finishes, it returns an integer to what?
The operating system.
38
Example of return statement indicating success?
return 0;
39
What does 'weakly typed' mean in C?
Allows implicit type conversions, leading to potential issues.
40
Potential issue converting larger types to smaller types in C?
Data loss.