lecture four: compiling, testing, and naming Flashcards

(53 cards)

1
Q

What is Step 1 in the process?

A

Preprocessing,

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

What are the two main activities in Step 2: Compilation?

A

Lexical analysis and parsing

These activities are essential for converting source code into a format suitable for execution.

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

What does Step 3: Linking involve?

A

Combines compilation units and libraries, generates executable

Linking is the final step that creates an executable program from the compiled code.

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

Fill in the blank: Step 1 includes _______.

A

preprocessor commands

Preprocessor commands are directives that instruct the compiler to perform specific actions before actual compilation.

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

True or False: Step 2 involves generating executable code.

A

False

Step 2 focuses on lexical analysis and parsing, not on generating executable code.

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

What is generated in Step 3?

A

Executable

The executable is the final output that can be run on a computer.

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

What is the purpose of Lexical Analysis?

A

Finds tokens (names, symbols) and builds Symbol Table

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

What does Syntactic Analysis accomplish?

A

Parses code using grammar and builds Abstract Syntax Tree (AST)

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

What does Semantic Analysis involve?

A

Type resolution and semantics

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

What types of errors can be generated during analysis?

A

Syntax errors and warnings

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

What is generated after Semantic Analysis?

A

Intermediate Representation (LLVM IR)

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

Is Intermediate Representation platform dependent or independent?

A

Platform independent

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

What is the role of the Preprocessor?

A

Includes .hpp files, evaluates #ifndef, #define, and instantiates templates

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

Is the Preprocessor platform dependent or independent?

A

Platform independent

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

At what level is optimization typically done?

A

IR level

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

What does Code Generation convert IR into?

A

Platform specific assembler

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

What does the assembler convert to after Code Generation?

A

Machine code

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

Is Code Generation platform dependent or independent?

A

Platform dependent

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

What is the purpose of Linking?

A

Links all the separate object files and associated libraries, and creates an executable file

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

What can occur during the Linking process?

A

Linker errors

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

What does Execution involve?

A

Loader reads exe from disk and loads into memory, CPU executes each machine instruction

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

What types of errors can occur during Execution?

A

Runtime errors

23
Q

What is the objective of software testing?

A

To cause failures to find faults/errors in the system

24
Q

Define a Failure in the context of software testing.

A

An incorrect output for a given input

25
What causes Failures?
Faults/errors in your program
26
What is a Fault?
An incorrect piece of code/document (bug)
27
Give examples of faults.
Missing condition, incorrect stopping condition, wrong equation, etc.
28
What is the purpose of test cases?
To exercise your program with the goal of uncovering faults
29
What is done after a failure is identified?
Debugging is done to identify the fault/error(s) in the code
30
What characterizes the best test case?
Has a high probability to cause a failure
31
What is the first step in testing?
Start by testing each method (unit tests)
32
What is the second step in testing?
Then each class in full (module tests)
33
What is the final step in testing?
Then the whole program (system tests)
34
What is an Assertion (ASSERT)?
A statement that is true at a specific point in the program
35
What is a Pre-condition (REQUIRES)?
A statement that must be true before a method/function is called/executed
36
What is a Post-condition (ENSURES)?
A statement that is true after a method/function is executed
37
What are Invariants?
Statements that are always true
38
What is a LOOP INV?
Statement that is always true within the scope of a loop
39
What is a CLASS INV?
Statement that is always true for an object of a given type/class
40
What is a GLOBAL INV?
Statement that is always true globally
41
What is black-box testing?
Uses only the I/O spec to develop test cases
42
What does black-box testing ignore?
The implementation; tests to specification
43
What is glass (white) box testing?
Uses only the implementation details to develop test cases
44
What does glass box testing ignore?
The specification; tests the code
45
What is necessary to develop a good set of test cases for a method/function?
Both black-box and glass box testing information
46
Why is testing critical in development?
Without testing, you do not have a functioning application (bugs)
47
What are the steps to writing a method/function?
1. Determine the I/O spec 2. Develop test cases 3. Implement the method 4. Run the method against the test cases 5. Fix any faults (debugging) 6. Go to 4 until all tests pass
48
What is the TDD Mantra?
Develop test cases before you code
49
What should you do each time you add code in TDD?
Test each time you add code
50
What naming style uses camelCase?
Capitalize words after the first
51
What does under_score naming style use?
Underscores between words, isolated imbedded underscores
52
What should be avoided in naming conventions?
Abbreviations and acronyms, unless commonly known
53
What must a name reflect in coding?
Its meaning and use in the code