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 technology
  1. compilation fails

  2. pi is bigger than 3

  3. An Exception occurs at runtime

  4. pi is bigger than 3. Have a nice day

  5. pi is not bigger than 3. Have a nice day

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

The finally keyword can only be used with a try block. Here, finally is attached to an if-else statement, which is invalid syntax. A finally block must follow a try or try-catch construct, not conditional statements.

Multiple choice technology
  1. 0

  2. 1

  3. 4

  4. Compilation fails

  5. An Exception thrown at runtime

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

If the string literal is "\s" (single backslash), this is invalid because \s is not a recognized escape sequence in Java. String escape sequences like \n, \t, \" must be valid. To represent a regex backslash, you need "\\s" (double backslash in source = single backslash in string).

Multiple choice technology
  1. int Long

  2. Short Long

  3. Compilation fails

  4. An Exception thrown at runtime

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

For go(y) with primitive short, Java prefers widening primitive conversion (short -> int) over autoboxing to Short. So go(int) is called. For go(z) with primitive long, only go(Long) matches via autoboxing (long cannot widen to int). Output is "int Long".

Multiple choice technology
  1. Hello

  2. Hello World

  3. Compilation fails

  4. Hello World 5

  5. The code runs with no output.

  6. An exception is thrown at runtime

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

Line 19 attempts to call another constructor using 'Hello()' but this is invalid syntax. In Java, to chain constructors you must use 'this(...)' or 'super(...)' as the first statement. The statement 'Hello();' looks like a method call but there's no method named Hello(), so this code will not compile. Even if it were correct constructor chaining, line 14 would throw NullPointerException because title is null when += is attempted.

Multiple choice technology programming languages
  1. A. FORDER IF E DISK

  2. B. FORDER IPE F 41 DISK

  3. C. FORDER IF E 41 DISK

  4. D. FORDER IF F DISK

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

For externally-described input files in IBM i, the F-spec format uses IF (Input file, Externally-described). The record length is defined in the external file description, not in the F-spec, so no length parameter is needed. Option C includes an unnecessary 41 byte parameter, and option D incorrectly uses F (fixed-length) instead of E (externally-described).

Multiple choice technology web technology
  1. Common Language Runtime

  2. Communication Language Runtime

  3. Common Language Realtime

  4. Common Lease Runtime

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

CLR stands for Common Language Runtime. It is the virtual machine component of Microsoft's .NET framework that manages the execution of .NET programs and provides services like memory management and security.

Multiple choice technology programming languages
  1. green

  2. Oak

  3. bean

  4. applet

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

Java was initially named Oak during its development (1991-1995) because of an oak tree outside James Gosling's office. It was renamed Java when the developers discovered Oak was already trademarked. Green, Bean, and Applet are all Java-related terms but not the original name.

Multiple choice technology programming languages
  1. An interpreter language

  2. A compiler language

  3. Partial compiler and interpreter language

  4. An Indian language

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

Perl is a hybrid language; it compiles the source code into an internal bytecode representation before executing it immediately via its built-in interpreter.

Multiple choice technology programming languages
  1. Powerful Encryption and Report Language

  2. Practical Extraction and Report Language

  3. Practical Emotional and Rational Language

  4. Powerful Execution and Riding Language

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

PERL is officially an acronym for Practical Extraction and Report Language, coined by Larry Wall to reflect Perl's original purpose in text processing and report generation. The backronym 'Pathologically Eclectic Rubbish Lister' is a humorous later addition.

Multiple choice technology programming languages
  1. App_Data

  2. App_Resources

  3. App_Code

  4. App_WebReferences

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

In ASP.NET, placing a .wsdl or .xsd file in the App_Code folder automatically triggers the runtime to generate a corresponding proxy class or typed dataset, making it available to the application.