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
  1. a low-level programming language.

  2. a scripting language precompiled in the browser.

  3. a compiled scripting language

  4. an object-oriented scripting language

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

JavaScript is fundamentally an object-oriented scripting language that runs primarily in web browsers. It uses prototype-based inheritance rather than class-based inheritance. It's not a low-level language, not precompiled in browsers (interpreted), and while modern engines compile it, its design is as a dynamic scripting language.

Multiple choice general knowledge
  1. One is not a method of the String object.

  2. substr() takes three arguments, substring() only two.

  3. Only one accepts a desired string length as an argument.

  4. Besides the spelling, nothing

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

substr() accepts a start position and length parameter, while substring() takes start and end positions. Only substr() allows specifying the desired string length directly. Option A is incorrect because both are String methods. Option B is wrong because neither takes three arguments. Option D is false because their parameter semantics differ fundamentally.

Multiple choice general knowledge
  1. One is not a method of the String object.

  2. substr() takes three arguments, substring() only two.

  3. Only one accepts a desired string length as an argument.

  4. Besides the spelling, nothing

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

substr() accepts a start position and length parameter, while substring() takes start and end positions. Only substr() allows specifying the desired string length directly. Option A is incorrect because both are String methods. Option B is wrong because neither takes three arguments. Option D is false because their parameter semantics differ fundamentally.

Multiple choice general knowledge
  1. The Java console

  2. LiveConnect

  3. LiveWire

  4. LiveWire Pro

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

LiveConnect was the technology that enabled JavaScript to communicate with Java applets, allowing JavaScript to call Java methods and access Java properties. LiveWire and LiveWire Pro were server-side JavaScript technologies. The Java console is a debugging tool, not an integration mechanism.

Multiple choice general knowledge
  1. for(var i = 0; i < myString.length; i++) {

  2. var myArray = myString.split('x'); myString = myArray.join('');

  3. It wasn't possible until now. Thanks JavaScript1.2!

  4. The first two both work fine

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

Before JavaScript 1.2's enhanced String.replace(), you could remove characters using two approaches: 1) iterate through the string building a new string without 'x', or 2) split on 'x' and join the array with empty string. Both methods work, though split/join is more concise.

Multiple choice general knowledge
  1. platform independent

  2. platform dependent

  3. traditional language

  4. None

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

Java is platform-independent because Java bytecode (.class files) can run on any device that has a Java Virtual Machine (JVM). The 'Write Once, Run Anywhere' (WORA) principle means compiled Java code doesn't need to be recompiled for different platforms. This is a fundamental design feature of Java, making it different from platform-dependent languages like C++.

Multiple choice general knowledge
  1. Java

  2. PHP

  3. HTML

  4. C

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

Check is a unit testing framework for the C programming language. It provides a simple way to write and run tests for C code. The other languages listed (Java, PHP, HTML) have their own testing frameworks but Check is specifically designed for C.

Multiple choice general knowledge
  1. p1

  2. p2

  3. empty string

  4. name

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

The while loop copies 'name' to p2 but both p1 and p2 are incremented after each assignment. When the loop exits, p2 points to the null terminator, so printf(%s, p2) prints an empty string. The key is understanding post-increment behavior.

Multiple choice general knowledge
  1. p1

  2. p2

  3. empty string

  4. name

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

This is identical to question 82605. The while loop copies 'name' to p2 but both p1 and p2 are incremented after each assignment. When the loop exits, p2 points to the null terminator, so printf(%s, p2) prints an empty string.

Multiple choice general knowledge
  1. BASIC

  2. COBOL

  3. Java

  4. Pascal

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

The question is poorly framed - there's no single 'computer language of the Internet.' However, Java became historically significant for web applications due to platform independence and applets. BASIC and COBOL are older languages, Pascal is educational. The question likely expects 'Java' based on its web prominence.