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
  1. the prompt to print in the next available space

  2. a line to be skipped in the output

  3. a question mark to appear on the screen at the end of the statement

  4. an error to occur

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

A semicolon after the prompt suppresses the automatic newline and causes a question mark to appear at the end of the prompt, signaling that input is expected.

Multiple choice
  1. machine language, high-level language, and assembly language

  2. machine language, high-level language, and binary representation

  3. binary representation, machine language, and assembly language

  4. machine language, assembly language, and high-level language

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Machine language uses raw binary instructions directly executed by the CPU. Assembly language adds mnemonics for machine instructions but remains hardware-specific. High-level languages use human-readable abstractions and are machine-independent.

Multiple choice
  1. differ depending on the type of computer on which they are to be executed

  2. contain instructions written in 1s and 0s

  3. do not require knowledge of the internal operations of the computer

  4. more closely resemble English than BASIC

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Assembly language is machine-dependent because its instructions directly map to specific CPU architectures and instruction sets. Different processor families have different assembly languages, unlike portable high-level languages like BASIC.

Multiple choice
  1. values

  2. numbers

  3. commands

  4. names

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

High-level languages use descriptive names as symbolic references to memory locations and values. These names make programs readable for programmers while the compiler handles memory addresses.

Multiple choice
  1. a machine language

  2. short for Beginner’s All-Purpose Symbolic Instruction Code

  3. a high-level language

  4. useful only for writing business programs

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

BASIC stands for Beginner's All-Purpose Symbolic Instruction Code. It is a high-level language designed for beginners and general-purpose applications, not machine language or business-only use.

Multiple choice
  1. assembly

  2. machine

  3. low-level

  4. high-level

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

High-level programming languages are designed to be easier for humans to read, write, and understand. They use English-like statements and abstractions that hide complex machine operations. Low-level languages like assembly and machine code are closer to how computers actually process data.

Multiple choice
  1. English-like words

  2. 1s and 0s representing high and low electrical states

  3. BASIC

  4. Symbolic names to represent storage locations

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Machine language is the lowest-level programming language, directly executable by the computer's CPU. It consists entirely of binary digits (1s and 0s) representing high and low electrical states. This is what all high-level languages must eventually be translated into for execution.

Multiple choice
  1. It translates one statement of high level language program to machine language and immediately execute it.

  2. A translate which translates entire high level language to machine language and then executes it.

  3. It executes the program only.

  4. None of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

A compiler translates the entire high-level language program to machine language before execution, creating an executable file. This distinguishes it from interpreters (which translate and execute one statement at a time, described in option A) and pure executors. Option B correctly describes the compiler's two-step process.