Programming Language Concepts - paradigms, models, programming environments, binding times, syntax and translation stages - One Line Questions
1.
What is a 'token' in lexical analysis? —
A sequence of characters representing a meaningful unit.
2.
What is a 'syntax error'? —
A violation of the programming language's grammatical rules.
3.
What is a 'virtual machine' in the context of programming environments? —
A software emulation of a physical computer, often used for executing bytecode.
4.
What is the output of the 'parser' in a compiler? —
An Abstract Syntax Tree (AST) or Parse Tree.
5.
Lexical analysis (scanning) breaks the source code into: —
Tokens.
6.
What is the typical first stage in the translation process of a compiled language? —
Lexical analysis (Scanning)
7.
Which binding time is associated with the process of connecting different pieces of compiled code? —
Link-time
8.
A dynamic language typically performs more binding at: —
Run-time
9.
Which binding time is associated with the definition of language keywords and operators? —
Language design-time
10.
The process of assigning memory to a variable during program execution is an example of binding at: —
Run-time
11.
Which programming paradigm is based on mathematical logic and formal reasoning? —
Logic Programming
12.
Which of the following is a characteristic of a 'declarative' programming approach? —
Focus on describing the desired outcome.
13.
What is a common characteristic of 'pure' functional programming languages? —
Absence of side effects.
14.
What is the main advantage of using an interpreter over a compiler for certain tasks? —
Easier debugging and faster development cycles.
15.
Which programming model focuses on the flow of control and data through a sequence of operations? —
Imperative Model
16.
Which programming paradigm emphasizes the concept of 'objects' with data and methods? —
Object-Oriented Programming
17.
The concept of 'encapsulation' is central to which programming paradigm? —
Object-Oriented Programming
18.
SQL (Structured Query Language) is a prime example of which programming paradigm? —
Declarative
19.
Which paradigm uses recursion and immutability as core concepts? —
Functional
20.
Which programming paradigm is characterized by a focus on 'what' needs to be computed rather than 'how'? —
Declarative Programming
21.
Code optimization aims to: —
Improve the efficiency (speed, size) of the intermediate or target code.
22.
What is a common model for imperative programming? —
State transformation
23.
Binding a variable to a memory location typically happens at which binding time? —
Compile-time or run-time
24.
The association of a variable name with its scope is an example of binding that occurs at: —
Compile-time or interpretation-time
25.
Intermediate code generation typically occurs after which stage? —
Semantic analysis
26.
What is the final stage of a typical compiler? —
Code generation
27.
Type checking is typically performed during which translation stage? —
Semantic Analysis
28.
Which translation stage deals with the structure and grammar of the code? —
Syntax Analysis
29.
A 'symbol table' is primarily used by which compiler stages? —
Semantic Analysis and Code Generation
30.
Which translation stage is responsible for identifying if a sequence of tokens forms a valid structure according to the grammar rules? —
Syntax Analyzer (Parser)
31.
A 'parse tree' represents the syntactic structure of a program, which is generated by the: —
Syntax Analyzer (Parser)
32.
Which binding time occurs earliest in the software development lifecycle? —
Language design-time binding
33.
Which of the following is NOT typically considered a programming paradigm? —
Compilation
34.
What does a 'programming environment' typically include? —
A text editor, debugger, and compiler/interpreter
35.
Which of the following is an example of a programming environment component? —
Integrated Development Environment (IDE)
36.
Static typing in a programming language means type checking is primarily done at: —
Compile-time
37.
Syntax analysis (parsing) checks the source code for: —
Grammatical correctness according to the language's syntax rules.
38.
Which of the following describes the 'semantics' of a programming language? —
The meaning of statements.
39.
What is 'syntax' in the context of programming languages? —
40.
In the context of programming language translation, what is 'intermediate representation'? —
An abstract form of the program that is easier to optimize and translate.
41.
Binding refers to the association of a name with a thing. What is 'binding time'? —
The time at which a given binding is made.
42.
In functional programming, what is a key characteristic of functions? —
They always return the same output for the same input.
43.
What is the purpose of the 'semantic analyzer' in a compiler? —
To check for type consistency and other meaning-related errors.
44.
What is the primary goal of the 'code generator' stage? —
To produce target machine code or intermediate code.
45.
What is the primary role of a 'compiler'? —
To translate source code from one language to another (e.g., high-level to machine code).
46.
What is the role of a 'debugger' in a programming environment? —
To help programmers find and fix errors in their code.
47.
Just-In-Time (JIT) compilation is a technique often used in: —
Environments that compile bytecode to native machine code during runtime.
48.
The 'linker' is responsible for: —
Combining object files and libraries into an executable program.
49.
An 'interpreter' typically executes source code by: —
Executing the source code instruction by instruction without prior translation.