Prog Lang Final Exam Questions Flashcards

1
Q

Which phase converts source code into tokens?

A

Lexical analysis

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

What does { } mean in EBNF?

A

Repetition

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

Which reserved word is used to declare a constant in Java?

A

final

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

What is produced during syntax analysis?

A

Parse tree or AST

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

Which of the following is NOT a reserved word in Java?

A

define

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

Which category do if, else, and switch belong to in Java reserved words?

A

Control flow keywords

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

Which of the following best describes semantics?

A

The meaning of a program

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

Which statement is true about syntax and semantics?

A
  • Syntax errors can occur even if semantics are correct
  • Semantic errors can occue even if syntax is correct
  • Both syntax and semantics must be correct for a program to function properly
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does static binding refer to?

A

Binding that occurs before the program runs

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

What is the purpose of a symbol table in a compiler?

A

To store mappings of names to their attributes

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

What is an example of dynamic binding?

A

Determining the type of a variable at runtime

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

What is a dangling reference?

A

A pointer pointing to deallocate memory

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

Which language uses garbage collection to handle memory management?

A

Java

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