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 programming languages
  1. a. LINE will hold the first record.

  2. b. Error

  3. c. LINE will hold the last record.

  4. d. LINE is empty.

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

In the LOOP AT ITAB INTO LINE construct, the work area LINE receives each row of the internal table during each iteration. After the loop completes, LINE contains the last record that was processed. This is standard ABAP behavior - the work area holds whatever value was last assigned to it. Option A is incorrect because LINE only temporarily holds one record at a time during iteration. Option B is incorrect because no error occurs. Option D is incorrect because LINE contains the last processed record, not nothing.

Multiple choice technology web technology
  1. Open source general purpose

  2. Proprietary general purpose

  3. Open source special purpose

  4. Proprietary special purpose

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

PHP is fundamentally designed as an open-source, general-purpose scripting language. The 'open source' means its source code is freely available for anyone to use and modify. 'General purpose' indicates it can handle various types of programming tasks beyond web development, though it is especially well-suited for web applications. Options B and D are incorrect because PHP is not proprietary. Option C is incorrect because PHP is not limited to special purposes.

Multiple choice technology web technology
  1. PHP can be used to develop web applications

  2. PHP makes a website dynamic.

  3. PHP applications can not be compiled.

  4. PHP can not be embedded into html.

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

This question asks which statement is NOT true (i.e., which is false). Option D claims 'PHP can not be embedded into html,' which is a false statement because PHP CAN indeed be embedded into HTML using PHP tags. Options A, B, and C are all true statements: PHP can develop web apps, PHP makes websites dynamic by generating content server-side, and PHP scripts are interpreted rather than compiled (though modern PHP can be compiled via various tools, the statement uses 'can not' which is technically accurate for traditional usage).

Multiple choice technology web technology
  1. <? ?>

  2. <script language=”php”> </script>

  3. <% %>

  4. <?php ?>

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

The tag is the most portable PHP delimiter because it is XML-compliant and works in XHTML documents. Short tags like ?> depend on php.ini configuration and may not work in all environments. The tag format is verbose and rarely used. ASP-style tags <% %> are deprecated and removed in PHP 8. Using <?php ensures your code works across different server configurations and XML-based document types.

Multiple choice technology web technology
  1. $get
  2. $ask
  3. $request
  4. $post
Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

PHP has several predefined superglobal variables: $_GET, $_POST, $_REQUEST, $_SERVER, $_SESSION, etc. These are auto-populated by PHP. The variable '$ask' is NOT a predefined PHP variable - it would need to be created by the developer. Options A, C, and D all refer to common PHP superglobals (though they should be written as $_GET, $_POST, $_REQUEST with underscores and in uppercase). The question tests knowledge of built-in versus custom variables.

Multiple choice technology web technology
  1. It can never be changed or undefined

  2. It can never be changed but can be undefined

  3. It can be changed but can not be undefined

  4. It can be changed and can be undefined

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

Once a constant is defined in PHP using define(), it cannot be changed or undefined during script execution. This is the fundamental purpose of constants - to provide immutable values that remain consistent throughout the program. Option B is wrong because constants cannot be undefined either. Options C and D are incorrect because constants cannot be changed at all after definition. Constants are global in scope and their value is fixed for the entire script runtime.

Multiple choice technology web technology
  1. Declarations

  2. Scriptlets

  3. Expressions

  4. Include

Reveal answer Fill a bubble to check yourself
A,B,C Correct answer
Explanation

JSP has three main scripting elements: Declarations (<%! %>) for declaring variables/methods, Scriptlets (<% %>) for embedding Java code, and Expressions (<%= %>) for outputting values. Directives and actions are not considered scripting elements.

Multiple choice technology web technology
  1. 5

  2. 3

  3. 4

  4. 2

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

JSP defines exactly three scripting elements: Declarations, Scriptlets, and Expressions. These correspond to the three ways of embedding Java code in JSP pages - for declarations, procedural code, and output expressions respectively.

Multiple choice technology web technology
  1. <js>

  2. <javascript>

  3. <script>

  4. <scripting>

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

The HTML5 specification defines the `element for embedding or referencing executable client-side scripts, such as JavaScript code. Non-standard elements like<js>,<javascript>, and<scripting>` are unrecognized by modern web browsers and will not execute the enclosed code blocks.

Multiple choice technology web technology
  1. "Hello World"

  2. document.write("Hello World")

  3. response.write("Hello World")

  4. ("Hello World")

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

document.write('Hello World') is valid JavaScript syntax that outputs text directly to the HTML document. This method writes during page parsing and is commonly used for simple output scenarios. Option A is just a string literal without any execution context. Option C uses ASP syntax (response.write), not JavaScript. Option D is syntactically incomplete - just parentheses without a function call.

Multiple choice technology mainframe
  1. True

  2. False

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

COBOL is a structured programming language despite its age. Modern COBOL supports structured programming constructs like IF-ELSE, EVALUATE (case-like), PERFORM loops, and modular programming through CALL and nested programs. While early versions had unstructured elements (like GO TO), the language evolved to support structured programming principles.

Multiple choice technology programming languages
  1. Boston University

  2. Arizona State University

  3. University of Munich

  4. London University

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

ATS (Applied Type System) was developed by Hongwei Xi and colleagues at Boston University. It's a programming language designed to support formal verification through advanced type systems, allowing specification and verification of program properties.