Chapter 1 Flashcards

1
Q

What is a programming language?

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

What are the different levels of programming languages?

A

hardware > machine language > assembly language > high-level language

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

What is a programming paradigm?

A

basic assumptions, ways of thinking, or methodologies that are commonly accepted by members of a group or community

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

Give four examples of programming paradigms.

A

object-oriented, imperative, logic, and functional

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

How is a program written in machine language?

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

How are machine language instructions processed by the CPU?

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

Is it possible to have conditions and loops in code written in machine language?

A

no

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

How is a program written in assembly language different from a program written in machine language?

A

machine language is composed of 1’s and 0’s only
assembly language uses characters and numbers

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

Is code written in assembly language executed in sequential order?

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

What is needed to execute a program in assembly language?

A

an assembler

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

What is the function of an assembler?

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

What are the three elements that every single high-level programming language is able to handle?

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

All high-level programming languages require that a variable be defined with a specific data type. (T or F)

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

What is the function of a compiler?

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

Is the compiler the one running the program?

A

no

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

How did punch cards work? (bonus)

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

What are the registers in the CPU? How do they play a role in the execution of instructions in a computer? (bonus)

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

When a value is stored in a variable, what actually happens in the computer? Where is it stored and how does the computer refer to the place it is stored?

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

Are there languages that support more than one paradigm?

A

yes

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

Give two examples of object-oriented programming languages.

A

C++ and Java

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

What is the programming paradigm of Scheme?

A

functional?

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

What is the key idea of procedural programming?

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

What is the key idea of object-oriented programming?

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

What is the key idea of functional programming?

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

What is the key idea of logic programming?

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

What are the main features of procedural programming?

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

What are the main features of object-oriented programming?

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

What are the main features of functional programming?

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

What are the main features of logic programming?

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

Inheritance is a feature of imperative programming. (T or F)

A

F

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

Instance variables are available in imperative programming. (T or F)

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

What is a language?

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

What is a high-level programming language?

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

What is a low-level programming language?

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

Is Java low-level or high-level?

A

high-level

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

What does object-oriented programming mean?

A
37
Q

What is an operator?

A
38
Q

What is a lexical rule?

A
39
Q

What is a syntactic rule?

A
40
Q

What is a semantic rule?

A
41
Q

What is a lexical error?

A
42
Q

What is a syntactical error?

A
43
Q

Give an example of a lexical rule in Java.

A
44
Q

Give an example of a syntactical rule in Java.

A
45
Q

int $ = 1;

Is this sentence correct on the lexical, syntactical, and semantics level in Java?

A

lexical = yes
syntactical =
semantics =

46
Q

int x = ‘a’;

Is this sentence correct on the lexical, syntactical, and semantics level in Java?

A

lexical = yes
syntactical = yes
semantics = yes

47
Q

for(;;);

Is there a syntactical error in this sentence in Java?

A

no

48
Q

Does a lexical error cause a syntactical error?

A
49
Q

Does a syntactical error cause a lexical error?

A
50
Q

12938102&qwerty-1a1a1a/xyzw(;}”aaa999;

(written in Java)
How many words are there?
Are there any lexical errors?
Are there any syntactical errors?

A

2, no, yes

51
Q

int Int = 0xFF-.7/7.;

(written in Java)
How many words are there?
Are there any lexical errors?
Are there any syntactical errors?

A

1, no, yes

52
Q

What is a compiler?

A
53
Q

What is an assembler?

A
54
Q

What is a linker?

A
55
Q

What is object code?

A
56
Q

What is an interpreter?

A
57
Q

What does portability mean?

A
58
Q

What does it mean when a compiler + a virtual machine are used to process a program?

A
59
Q

What does it mean when a compiler + compiler are used to process a program?

A
60
Q

What is intermediate code?

A
61
Q

What is the main advantage of using an interpreter over using a compiler?

A
62
Q

What is the main advantage of using a compiler over an interpreter?

A
63
Q

What are the primitive data types?

A

int, float, double, char, void

64
Q

What types are not primitive?

A

array, structure, union, enum

65
Q

How do objects, arrays, and primitive variables look in the memory?

A
66
Q

Where are primitive global variables stored in the memory?

A
67
Q

Where are primitive local variables stored in the memory?

A
68
Q

Where are non-primitive global variables stored in the memory?

A
69
Q

Where are non-primitive local variables stored in the memory?

A
70
Q

What is a reference?

A
71
Q

What is the heap?

A
72
Q

What is the stack?

A
73
Q

What is stack overflow?

A
74
Q

What is the size of an int (in bytes)?

A

4

75
Q

What is the size of a long (in bytes)?

A

8

76
Q

What is the size of a float (in bytes)?

A

4

77
Q

What is the size of a double (in bytes)?

A

8

78
Q

What is a variable?

A
79
Q

Why does a variable need a data type?

A
80
Q

Is Java a weakly-typed or strongly-typed language?

A

strongly-typed

81
Q

What is casting?

A
82
Q

What is coercion?

A
83
Q

What is structural equivalence?

A
84
Q

What is name equivalence?

A
85
Q

Does Java apply structural equivalence for non-primitive data?

A
86
Q

Does Java apply name equivalence for non-primitive data?

A
87
Q

Which language has strong-type checking?

Java
C
C++

A

Java
C++?

88
Q

Which language has weak-type checking?

Java
C
C++

A

C