Quiz Question 1 5 points Which of the following phases are g
Quiz
Question 1 (5 points)
Which of the following phases are generally not included in the first pass of most compilers of fully compiled languages?
Question 1 options:
Syntactic analyzer
Lexical analyzer
Final code generator
Semantic analyzer
Question 2 (5 points)
Which of the following phases of a compiler of a fully compiled language is machine dependent?
Question 2 options:
Lexical analyzer
Syntactic analyzer
Semantic analyzer
Final code generator
Question 3 (5 points)
Which of the following is not a compilation error?
Question 3 options:
Logic error
Static semantic error
Syntax error
Lexical error
Question 4 (5 points)
Which of the following languages is the newest?
Question 4 options:
C++
Ada
C
C#
Java
Question 5 (5 points)
Which of the following language translators translates and executes programs each time it is run?
Question 5 options:
A compiler
An interpreter
An assembler
A JIT compiler
Question 6 (5 points)
Which of the following programs is responsible for combining the object files that result from separate compiled source files?
Question 6 options:
An assembler
An interpreter
A compiler
A linker
Question 7 (5 points)
What kind of an error is an unresolved external reference?
Question 7 options:
Syntax error
Linker error
Lexical error
Static semantic error
Question 8 (5 points)
When every combination of two language features are valid, what term describes the relationship between those features?
Question 8 options:
Combinable
Compatible
Independent
Orthogonal
Question 9 (5 points)
Which of the following languages uses a hybrid implementation?
Question 9 options:
C
Ada
Java
C++
Question 10 (5 points)
Which of the following is not a correct statement regarding feature interaction?
Question 10 options:
Feature interaction can cause logic errors
Feature interaction is a highly desirable language characteristic
Feature interaction can cause ambiguities detected by the compiler
The more features a programming language has, the more likely the features are to interact
Question 11 (5 points)
What is the output of the syntactic analyzer?
Question 11 options:
Parse Tree
Tokens
Lexemes
Intermediate code
Question 12 (5 points)
In a fully compiled language, which pass is machine independent?
Question 12 options:
The second pass
Both of them
None of them
The first pass
Question 13 (5 points)
Which of the following is the input to a compiler?
Question 13 options:
Object code
Intermediate code
Source code
Executable code
Question 14 (5 points)
Which of the following languages is not an imperative language?
Question 14 options:
Fortran
ALGOL
Prolog
COBOL
Question 15 (5 points)
What language was the first high level language designed for computerizing business records?
Question 15 options:
Fortran
LISP
COBOL
APL
Question 16 (5 points)
Which of the following languages was designed as a functional programming language?
Question 16 options:
COBOL
ALGOL
LISP
Fortran
Question 17 (5 points)
Which of the following languages is not an object-oriented language?
Question 17 options:
C++
C
Java
Ada 95
Question 18 (5 points)
In which of the following orders did the C family of languages evolve?
Question 18 options:
C, C#, Java, C++
C, C++, Java, C#
C, C#, C++, Java
C, C++, C#, Java
Question 19 (5 points)
Which of the following translation systems produces the fastest program execution?
Question 19 options:
A full compiler
A preprocessor
A hybrid implementation
An interpreter
Question 20 (5 points)
In C or C++, when a = is used when a == is intended, which of the following occur?
Question 20 options:
The code is misinterpreted and a logic error is the result
The program fails to compile
A runtime exception will be thrown
The = is automatically changed to a ==
| Note: It is recommended that you save your response as you complete each question. |
Solution
Question 1:
The first pass of a compiler of fully compiled languages includes the following phases:
· Syntax analyzer
· Lexical analyzer
· Semantic analyzer
These phases are used to create the intermediate representation of the code. These phases are included in the analysis phase.
The phase final code generator is the phase of back end and included in the synthesis pass which is used to create the final code to run on the machine.
Hence, the correct choice is final code generator.
Question 2:
The final code generated for each source code will be different for each machine because the source code will be different for each machine. Thus, the final code generation is dependent on machine.
Hence, the correct choice is final code generation.
Question 3:
The types of compilation errors are as follows:
· Lexical error: This type of errors shows the error in the text of the code.
· Semantic error: This type of error shows the error in the statement if the meaning of that statement is not correct.
· Syntax error: this type of error shows the errors associated with the syntax of the code.
The logic error is included in the run-time errors and it is not a compilation error.
Hence, the correct choice is logic error.
Question 4:
The languages C++, Ada, C, C#, and java are placed in the old language to the new language manner as follows:
· C: the C language is developed in 1973.
· C++: this language is developed in 1979.
· Ada: this language was developed in 1980.
· Java: this language was developed in 1995.
· C#: this language was developed in 2000.
Based on the above facts, it is clear that the C# language is the newest language.
Hence, the correct choice is C#.
Question 5:
The language translators are used to convert a code from high level to the low level or machine code language. An interpreter is a type of translator which is used to convert the source code to machine code each time the program is executed. The interpreter starts interpreting the code line by line.
Hence, the correct choice is an interpreter.
Question 6:
The linker is the part of the execution of a program which is used to combine the object files generated due to the compilation of various files into a single file which is executed on machine after trabslated into machine code.
Hence, the correct choice is a linker.
Question 7:
If a variable is defined in some other files or external to the present file, then the linker should get the value of that external variable when the object files are combined.
The value of that external variable should be resolved in each function or files where it is used. If te linker cannot resolve the value of the external variable, then it will generate an error that is called as linker error.
Hence,the correct choice is linker error.
Question 8:
If the features of two languages are combined and the resultant features of the combined language comes out to be valid, then it means both language are orthagonal.
Hence, the correct choice is orthagonal.
Question 9:
The hybrid implementation in a language is used to translate the source code to an intermediate language and then interpreter will translate this intermediate language to the machine code.
This implementation is better and faster than the translation of source code to machine code directly because it is easier for the interpreter to translate an intermediate language to machine code rather than translating source code to machine code directly.
Java’s source code is first translated to intermediate language i.e., byte code and then it is translated to the machine code. This process is performed by java virtual machine (JVM).
JIT is a translator which is used for the java programs to translate its source code to intermediate byte code and then to machine code. Therefore, java uses the hybrid implementation.
Hence, the correct choice is java.
Question 10:
The feature interaction is a concept which is used to combine feature of two modules and the resultant features of the module is modifying the feature of either one or both modules. The feature interaction can combine the features of two modules that\'s why it is very desirable characterstic.
Hence, the correct choice is feature interaction is a highly desirable characterstic.
Question 11:
The syntactic analyzer is used to build a parse tree using the tokens generated by the lexical analyzer.
Hence, the correct choice is parse tree.
Question 12:
There are two pass of a compiler analysis and synthesis. Analysis pass is used to create the intermediate code generation and checks for the syntax, grammer, and lexical errors. The synthesis pass is used to generate the final code to run on a machine.
The final code will be dependent on the machine or assembler. Therefore, second pass is dependent on machine.
Hence, the correct choice is the first pass.
Question 13:
The input to a compiler is the source code with the preprocessed header files and compiler generates the assembly code of the input source code.
Hence, the correct choice is source code.
Question 14:
The imperative languages are the languages which focuses on the operation of a program. It is based on computer’s command. The examples of the imperative language are listed as follows:
· Fortran
· AlGOL
· COBOL
The Prolog is a language of interactive type in which the output of a statement can be shown as soon as it is executed. Therefore, the prolog is not an imperative language.
Hence, the correct choice is Prolog.
Question 15:
A high level language is a language which is readable to humans and can be executed on machines after converted to the machine code using compiler. The first high level language to computerize business records was COBOL.
COBOL has simple statements written in English which are human readable and the date and code is separated in this language for the simplicity. It was developed in May, 1959.
Hence, the correct choice is COBOL.
Question 16:
The functional programming lanuages include the building of code in a style such that it uses programs or routines to perform a some task. LISP is the language which was designed for the functional programming language.
The COBOL, ALGOL, and Fortran are the imperative languages.
Hence, the correct choice is LISP.
Question 17:
The C is a procedural language which use procedures to perform tasks. On the other hand, C++, Java, and Ada 95 are the object oriented languages.
Hence, the correct choice is C.
Question 18:
The order of the evolution of C family is given as follows:
· C: this language was developed in 1973.
· C++: this language was developed in 1979.
· Java: this language was developed in 1995.
· C#: this language was developed in 2000.
Hence, the correct choice is C, C++, Java, C#.
Question 19:
The interpreter is faster than compiler in case of interpretin the code line by line. The compiled code is faster than an interpreter.
Hence, the correct choice is a full compiler.
Question 20:
If the statement in if condition is used like a = 1 instead of a == 1, then the program will compile sucessfully but the output will be incorrect because a = 1 is not a valid condition and it gives a logical error.
Hence, the correct choice is the code is misinterpreted and a logic error is the result.







