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. subs(F,x,,5)

  2. subs(f,5,x)

  3. subs(5,f,x)

  4. subs(f,x,5)

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

The subs function syntax is subs(expression, variable, value). For f=3*x^2, subs(f, x, 5) substitutes x=5. Options A has wrong syntax with double comma. Options B and C swap arguments - subs expects (f, variable, value), not (f, value, variable) or (value, f, variable).

Multiple choice general knowledge science & technology
  1. well-formed

  2. well-documented

  3. non-validating and validating

  4. none of the above

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

The claimed answer C (non-validating and validating) is correct. XML parsers are classified into two main types: non-validating parsers (check only for well-formedness) and validating parsers (check both well-formedness and adherence to a DTD or schema). Options A, B, and D are incorrect as they don't represent actual parser classifications.

Multiple choice softskills business skills
  1. Sashelp.PrdSale

  2. Sasuser.MySales

  3. Profits.Quarter1

  4. all of the above

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

All three examples are permanent SAS datasets: Sashelp.PrdSale (library Sashelp), Sasuser.MySales (library Sasuser), and Profits.Quarter1 (library Profits). Permanent libraries persist between sessions, unlike the temporary Work library.

Multiple choice softskills business skills
  1. proc contents data=area51.all nods;

  2. proc contents data=area51 all nods;

  3. proc contents data=area51 all noobs;

  4. proc contents data=area51 all.nods;

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

In SAS, PROC CONTENTS with data=libname.ALL lists all datasets in a library. The NODS option suppresses detailed dataset information. The correct syntax requires a two-level name with the library prefix and an underscore before and after ALL. Option A has the correct spacing and syntax.

Multiple choice softskills creativity
  1. Java

  2. C/C++

  3. Python

  4. Pascal

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

C/C++ is faster than Java, Python, and Pascal because it's compiled to machine code without the overhead of a virtual machine or interpreter. Java uses JVM, Python is interpreted, and Pascal is generally slower than C. C/C++ gives the most direct hardware control.

Multiple choice softskills creativity
  1. Nothing

  2. 3

  3. 1

  4. 2

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

The while(1); statement is an infinite loop - the semicolon makes it an empty statement that repeats forever. The lines c++ and printf are unreachable code that never executes. The program hangs in the infinite loop, producing no output. This is a classic unreachable code scenario.

Multiple choice softskills creativity
  1. 3.4141

  2. 3.41426

  3. 3.414164

  4. 3.4142

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

The format specifier %0.4f means print with 4 decimal places. Standard rounding applies: 3.414164 rounded to 4 places looks at the 5th digit (6), which rounds the 4th digit up from 1 to 2. Therefore 3.4142 is printed. Options A, B, and C are incorrect because they either truncate or round incorrectly.

Multiple choice softskills creativity
  1. 12345

  2. 1234

  3. 123

  4. 1

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

The do-while executes once with i=1, printing 1 and incrementing i to 2. The if(i<15) condition is true, so continue jumps back to loop condition. The while(false) condition fails, terminating the loop. Only 1 is printed. The continue statement affects loop control but the false condition guarantees single execution.

Multiple choice softskills creativity
  1. 1212

  2. 121.2

  3. 12f(1,2)

  4. 12f(12)

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

The macro f(a,b) uses ## (token pasting) to concatenate 1 and 2 into 12. Macro h(a) calls g(a) which stringifies with #a. So h(f(1,2)) becomes g(12) then f(1,2) as string literal. The first printf outputs f(1,2). The second printf calls g(f(1,2)) directly, which stringifies to 12. Output: f(1,2)12.