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

Multiple choice general knowledge science & technology
  1. File Translation

  2. Format Translation

  3. Formula Translation

  4. Floppy Translation

Reveal answer Fill a bubble to check yourself
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.

Multiple choice general knowledge science & technology
  1. Machine language

  2. Application software

  3. System program

  4. All of the above

Reveal answer Fill a bubble to check yourself
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.

Multiple choice general knowledge science & technology
  1. processing

  2. kilobyte

  3. binary

  4. representational

Reveal answer Fill a bubble to check yourself
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.

Multiple choice general knowledge science & technology
  1. 2,2

  2. 1,3

  3. 2,3

  4. 1,2

Reveal answer Fill a bubble to check yourself
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.

Multiple choice general knowledge science & technology
  1. Machine language

  2. Application software

  3. System program

  4. All of the above

Reveal answer Fill a bubble to check yourself
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.

Multiple choice general knowledge science & technology
  1. Alain Colmerauer

  2. Nicklaus Wirth

  3. Seymour Papert

  4. John McCarthy

Reveal answer Fill a bubble to check yourself
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.

Multiple choice general knowledge science & technology
  1. Interpreter

  2. Compiler

  3. Operating system

  4. Assembler

Reveal answer Fill a bubble to check yourself
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.

Multiple choice general knowledge science & technology
  1. Interpreter

  2. Loader

  3. Complier

  4. Assembler

Reveal answer Fill a bubble to check yourself
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.

Multiple choice general knowledge history
  1. i=0

  2. i=11

  3. Invalid argument to operation

  4. None

Reveal answer Fill a bubble to check yourself
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.

Multiple choice general knowledge history
  1. 10 & 12

  2. 10 & 10

  3. Compile Time Error

  4. None

Reveal answer Fill a bubble to check yourself
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.

Multiple choice general knowledge history
  1. i | j = 3

  2. i | j = 2

  3. Compile Time Error

  4. None

Reveal answer Fill a bubble to check yourself
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.

Multiple choice general knowledge history
  1. X=8

  2. X=10

  3. X=11

  4. None

Reveal answer Fill a bubble to check yourself
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.