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. Unboxing can throw InvalidCastException at runtime.

  2. In boxing, a copy of the value type is taken from the heap to the stack.

  3. In unboxing, a copy of the value type is taken back from the heap to the stack.

  4. Casting does not physically move or operate on the object.

  5. Both (2) and (4).

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

This is false as boxing refers to take the value type from the stack to the heap.

Multiple choice
  1. C

  2. C++

  3. Java

  4. FORTRAN

  5. LISP

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

The Abstract Window Toolkit (AWT) is Java's original platform-independent windowing, graphics, and user-interface widget toolkit. The AWT is now part of the Java Foundation Classes (JFC) — the standard API for providing a graphical user interface (GUI) for a Java program. AWT is also the GUI toolkit for a number of Java ME profiles.

Multiple choice
  1. C

  2. Fortran

  3. BASIC

  4. JAVA

  5. COBOL

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

Java is a general-purpose, concurrent, class-based, object-oriented computer programming language that is specifically designed to have as few implementation dependencies as possible. It is intended to let application developers write once, run anywhere (WORA), meaning that code that runs on one platform does not need to be recompiled to run on another.

Multiple choice
  1. Line reconstruction

  2. Lexical analysis

  3. Preprocessing

  4. Syntax analysis

  5. Semantic analysis

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

Lexical analysis breaks the source code text into small pieces called tokens. Each token is a single atomic unit of the language, for instance a keyword, identifier or symbol name. The token syntax is typically a regular language, so a finite state automaton constructed from a regular expression can be used to recognize it. This phase is also called lexing or scanning, and the software doing lexical analysis is called a lexical analyzer or scanner.

Multiple choice
  1. Deterministic context-free languages can be recognized by a deterministic turing machine.

  2. They are a proper subset of context-free languages.

  3. They can be accepted by a deterministic pushdown automaton.

  4. They are closed under union.

  5. They are closed under complement.

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

 DCFL is a subset of the complexity class SC. The set of deterministic context-free languages is not closed under union but is closed under complement.