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. C

  2. C++

  3. QBASIC

  4. FORTRAN

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

FORTRAN (FORmula TRANslation), developed by IBM and John Backus's team and released in 1957, was the first widely successful high-level programming language. It enabled scientists and engineers to write code using mathematical notation rather than assembly or machine code. C (1970s) and C++ (1980s) came decades later, while QBASIC was a 1990s educational language.

Multiple choice technology platforms and products
  1. Each parse xml rule contains set of parsing instructions for the PRPC

  2. XML message mapped to clipboard properties

  3. Rule extracts the data between delimiters

  4. None of the above

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

Rule-Parse-XML defines parsing instructions that map XML message elements to clipboard page properties. Each parse rule contains instructions for PRPC on how to extract and map data from XML to the clipboard. It does not extract data between delimiters (that's delimited parsing) and is specifically for XML-clipboard mapping.

Multiple choice technology programming languages
  1. 0

  2. 5

  3. 20

  4. undefined

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

The global constant x=5 is declared at file scope. Inside main(), 'int x[x]' creates an array of size 5 (using the global x, not a VLA since x is a constant). The local x (the array name) shadows the global x within main. 'sizeof(x)' returns the size of the local array (5 * sizeof(int) = 20 on most systems). Dividing by sizeof(int) gives 5. The local array declaration doesn't affect the global constant.

Multiple choice technology programming languages
  1. True

  2. False

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

This code is valid C++ (not C). 'int x = 5' declares a global variable x. 'class x' declares a class named x. In main(), 'class x y' declares a variable y of type class x. In C++, variable names and class/struct names occupy different namespaces, so 'int x' and 'class x' don't conflict. The code compiles successfully, making the answer True.

Multiple choice technology programming languages
  1. 5

  2. 3

  3. 0

  4. undefined

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

The array member of the struct is declared using the global constant SIZE which equals 5. Inside the member function size, sizeof(array) evaluates to 5 times the size of an integer, and dividing by sizeof(int) yields 5. The inner enum declaration defining SIZE as 3 hides the global constant in some contexts, but does not affect the array size determined at class scope definition.

Multiple choice technology programming languages
  1. True

  2. False

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

In C++, you cannot declare an array of references. 'int& x[50]' attempts to create an array of 50 references to int, which is syntactically illegal. References must be initialized upon declaration and cannot be reseated, making arrays of references impossible. This code will not compile, so the statement is False.

Multiple choice technology programming languages
  1. 0

  2. 5

  3. undefined

  4. 2

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

The global const int x = 5 is used to size the array inside main (int x[x] creates array of 5 ints). sizeof(x) on the array returns 5 * sizeof(int) = 20 (assuming 4-byte int). Dividing by sizeof(int)=4 gives y = 5. The local array x shadows the global x for the rest of the block.

Multiple choice technology architecture
  1. a.Show-XML

  2. b.Show-Html

  3. c.Show-Page

  4. d.Show-Step-Page

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

The Show-Page method displays step page information in XML format, which is useful for debugging activities. Show-XML and Show-Step-Page are not valid PRPC methods, and Show-Html would show HTML format, not XML.

Multiple choice technology programming languages
  1. 20

  2. 10

  3. 100

  4. -80

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

The macro XXX expands to 'ABC - XYZ', which becomes '20 - 10'. The expression 'a = XXX * 10' becomes 'a = 20 - 10 * 10'. Due to operator precedence, multiplication happens before subtraction: 10 * 10 = 100, then 20 - 100 = -80.

Multiple choice technology programming languages
  1. 5

  2. 7

  3. 8

  4. garbage value

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

To solve this question, we need to understand the order of operations and logical operators.

The given program uses the if statement to check some conditions. If the conditions are met, it increases the value of k. Finally, it prints the value of k using printf.

The given expression can be broken down into three parts:

  1. ++k < 5
  2. k++/5
  3. ++k <= 8

Let's evaluate each part:

  1. ++k < 5: The value of k is first incremented to 6. Then, this expression checks if 6 is less than 5. This is false, so the expression evaluates to false.

  2. k++/5: The value of k is still 6. This expression divides 6 by 5 (integer division), which evaluates to 1. However, this expression is not used in the if statement because of short-circuiting.

  3. ++k <= 8: The value of k is now 7 (due to the previous increment). This expression checks if 7 is less than or equal to 8. This is true, so the expression evaluates to true.

Since the expression in the if statement evaluates to true, the code inside the if statement is executed. This code does nothing, so k remains 7. Finally, the value of k is printed using printf.

Therefore, the output of this program is:

7

The answer is: B. 7

Multiple choice technology programming languages
  1. A type of coffee

  2. An object-oriented programming language

  3. An interactive website

  4. None of the above

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

Java is a high-level, class-based, object-oriented programming language that follows the WORA (Write Once, Run Anywhere) principle. It uses objects and classes to structure code, supports inheritance, encapsulation, polymorphism, and abstraction as core OOP concepts.

Multiple choice technology web technology
  1. Java programming is derived from C++

  2. The Java Virtual Machine(JVM) interprets the program for the native operating system

  3. The compiler is identical to a C++ compiler

  4. The APIs do all the work

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

Java achieves platform independence through the Java Virtual Machine (JVM), which interprets compiled bytecode for the specific host operating system. This 'Write Once, Run Anywhere' capability means the same compiled program can run on Windows, Linux, macOS, or any platform with a JVM without recompilation.

Multiple choice technology
  1. Keep with previous property

  2. Lot of objects to be displayed

  3. Complex conditions applied

  4. Large XML data

  5. Both A and C

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

When a Scriptura template runs slowly, the first properties to check are 'keep with previous' (which forces complex layout calculations) and complex conditions (which add processing overhead). These are the most common performance bottlenecks.