Computer Knowledge
Programming Languages and Compilers
2,284 Questions
Programming languages and compilers involve the rules, syntax, and semantics used to write and execute software programs. Key areas include scripting languages, object oriented concepts, and parsing algorithms like top down parsers. Practice these computer science questions to build proficiency for technical and computer knowledge exams.
Object oriented languagesScripting languagesCompilers and parsersProgramming syntax
Programming Languages and Compilers Questions
C
Correct answer
Explanation
COMAT is a historical high-level language that was designed to incorporate the simple, readable style of BASIC.
-
High-level language
-
Codes
-
Programs
-
Mnemonics
C
Correct answer
Explanation
Compilers and interpreters are software programs that translate high-level source code into machine-executable code.
-
ALGOL
-
SNOBOL
-
MIRANDA
-
FORTRAN
C
Correct answer
Explanation
ALGOL, SNOBOL, and FORTRAN were all languages used on early IBM mainframes. Miranda is a functional programming language developed much later (1985) and was not used on the IBM 7000 series.
B
Correct answer
Explanation
C++ is a well-known object-oriented programming language, being an extension of C with classes. C is a procedural language, and ADA and FORTRAN are also primarily procedural.
A
Correct answer
Explanation
AHPL stands for A Hardware Programming Language, which is a hardware description language used for describing digital systems.
D
Correct answer
Explanation
BCPL (Basic Combined Programming Language) was designed to facilitate structured programming and served as the precursor to B and C.
-
Top-down parsing
-
Bottom-up parsing
-
Both (1) and (2)
-
None of the above
B
Correct answer
Explanation
Top-down parsers (like LL parsers) fail and enter infinite loops when faced with left-recursive grammars. Bottom-up parsers (like LR parsers) are capable of handling left-recursive productions effectively.
A
Correct answer
Explanation
Lex is a classic Unix utility designed specifically to generate lexical analyzers (scanners) from regular expression specifications. Yaac is a parser generator, while TeX and EQN are formatting tools.
B
Correct answer
Explanation
Yacc (Yet Another Compiler Compiler) is a parser generator that creates parsers from grammar specifications. It works with Lex to build complete compiler front-ends. Lex handles lexical analysis while Yacc handles syntax analysis according to context-free grammars. TeX is typesetting software and Emacs is a text editor.
-
lexical analyzer.
-
scanner.
-
parser.
-
code generator.
C
Correct answer
Explanation
Syntax analysis, or parsing, is the stage where the compiler checks if the sequence of tokens conforms to the grammar of the programming language. This task is performed by the parser.
-
a machine language
-
an assembly language
-
a high level language
-
all of the above
B
Correct answer
Explanation
Assembly language uses mnemonics (like MOV, ADD) and symbolic labels (variable names) to represent machine instructions, making it more readable than raw machine code.
-
designs an algorithm
-
codes an algorithm in a programming language
-
debugs the program
-
all of the above
D
Correct answer
Explanation
Program development is a holistic process that includes defining the algorithm, writing the code, and testing/debugging to ensure correctness.
-
PASCAL
-
BASIC
-
FORTRAN
-
Both (1) & (3)
A
Correct answer
Explanation
Pascal was designed to encourage good programming practices, such as structured programming, by enforcing strict data typing and block structures. BASIC and early FORTRAN were historically less structured, though modern versions have evolved.
-
PASCAL
-
SNOBOL
-
FORTRAN
-
None of the above
B
Correct answer
Explanation
SNOBOL (String Oriented Symbolic Language) is a classic programming language specifically designed for string manipulation and pattern matching. Pascal and FORTRAN are general-purpose languages.
-
are compatible with each other
-
can be supported by any operating system
-
have the same syntax
-
none of the above