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
-
File Translation
-
Format Translation
-
Formula Translation
-
Floppy Translation
C
Correct answer
Explanation
FORTRAN is a programming language developed by IBM in the 1950s. The name comes from 'Formula Translation' because it was designed for scientific and engineering calculations involving mathematical formulas. 'File Translation' and 'Format Translation' are incorrect expansions.
-
Machine language
-
Application software
-
System program
-
All of the above
A
Correct answer
Explanation
Machine language (binary code of 0s and 1s) is the only language computers can directly understand and execute. Application software and system programs are written in higher-level languages that must be translated to machine language first.
-
processing
-
kilobyte
-
binary
-
representational
C
Correct answer
Explanation
Computers use binary language (base-2) to process data, representing all information as sequences of 0s and 1s. Binary is the fundamental language of digital computers. 'Processing' and 'representational' are not languages, and 'kilobyte' is a unit of digital storage measurement, not a processing language.
A
Correct answer
Explanation
++i is pre-increment (increments first, then returns new value), so i becomes 2 and prints 2. i++ is post-increment (returns current value, then increments), so it prints 2 again (current value) then increments to 3. Output: 2,2. Note: void main() is non-standard but works in some compilers.
-
Machine language
-
Application software
-
System program
-
All of the above
A
Correct answer
Explanation
Machine language (also called machine code) is the only language directly understood and executed by computers. It consists of binary instructions (0s and 1s) that the CPU can execute without translation. Application software and system programs are written in high-level languages that must be compiled or interpreted into machine language.
-
Alain Colmerauer
-
Nicklaus Wirth
-
Seymour Papert
-
John McCarthy
A
Correct answer
Explanation
Alain Colmerauer led the team that developed PROLOG at the University of Marseilles in 1972. PROLOG uses predicate calculus for symbolic logic and reasoning, making it fundamental to AI programming. Nicklaus Wirth created Pascal, Seymour Papert developed LOGO, and John McCarthy invented LISP.
-
AI
-
LISP
-
CL (Common Lisp)
-
both b and c
D
Correct answer
Explanation
To invoke a LISP system, you enter either 'LISP' for standard LISP implementations or 'CL' specifically for Common Lisp environments. Both commands are valid entry points to start programming in the LISP language family.
-
Interpreter
-
Compiler
-
Operating system
-
Assembler
C
Correct answer
Explanation
Operating system is the odd one out because it's system software that manages computer resources. Interpreter, compiler, and assembler are all language translators that convert code from one form to another.
-
Interpreter
-
Loader
-
Complier
-
Assembler
A
Correct answer
Explanation
An interpreter translates and executes high-level language code line by line, converting each statement to machine code before running it. A compiler converts the entire program at once, a loader loads programs into memory, and an assembler converts assembly language to machine code.
-
i=0
-
i=11
-
Invalid argument to operation
-
None
C
Correct answer
Explanation
The statement 'System.out.println("i="+++i);' contains a syntax error. The '++' is the pre-increment operator, but the expression '+++i' (which could be parsed as '++ + +i' or similar) is invalid Java syntax. In Java, you cannot have three plus signs in a row like this - it's ambiguous and the compiler will reject it.
A
Correct answer
Explanation
In Java, when you write 'int x=010;', the leading zero makes it an octal literal. Octal 010 equals decimal 8 (1*8^1 + 0*8^0 = 8). So the output is 'X=8'.
-
10 & 12
-
10 & 10
-
Compile Time Error
-
None
C
Correct answer
Explanation
The code int x=y=10; attempts to declare variables x and y and assign them values in a single statement. In Java, this syntax is invalid because y is being used before it has been declared - you cannot chain variable declarations like this when the first variable doesn't exist yet. The correct way would be int y=10, x=y; or declare them separately. Therefore, a compile-time error occurs.
-
i | j = 3
-
i | j = 2
-
Compile Time Error
-
None
A
Correct answer
Explanation
The bitwise OR operation i|j compares each bit of i (binary 11 = decimal 3) and j (binary 10 = decimal 2). Bitwise OR produces 1 if at least one operand has a 1 in that position. So: 11 | 10 = 11 (binary) which equals 3 in decimal. The output is i|j=3.
-
X=10
-
X=0
-
X=16
-
Compile Time Error
C
Correct answer
Explanation
The prefix 0x indicates a hexadecimal literal in Java. The value 0x10 in hexadecimal equals 16 in decimal (1×16 + 0×1 = 16). Therefore, the output is X=16.
A
Correct answer
Explanation
In Java (and several other programming languages), integer literals starting with 0 are interpreted as octal (base-8) numbers, not decimal. The literal '010' in octal equals 8 in decimal (1×8¹ + 0×8⁰ = 8). Therefore, when the code prints 'X=' + x, it outputs 'X=8'. This is a common trick question testing knowledge of octal notation in programming languages.