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 web technology
  1. Web Services Developing Language

  2. Web Services Definition Language

  3. Web Servers Definition Language

  4. None of these

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

WSDL stands for Web Services Definition Language. It is an XML-based language used to describe web services, their format, and how to access them. The key distractor A incorrectly says 'Developing' instead of 'Definition'.

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 designed to have as few implementation dependencies as possible. It was developed by Sun Microsystems (now Oracle) and is widely used for enterprise applications, Android development, and web backends. Coffee was the original inspiration for the name, but Java itself is code.

Multiple choice technology mainframe
  1. CHAR

  2. ORD

  3. REM

  4. REVERSE

  5. ANNUITY

  6. None

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

All listed functions are valid COBOL intrinsic functions: CHAR converts numeric to character, ORD returns ASCII ordinal value, REM calculates remainder of division, REVERSE reverses character strings, and ANNUITY calculates financial annuity values. Therefore 'None' correctly indicates that none of these is NOT an intrinsic function.

Multiple choice technology mainframe
  1. Compilation Error

  2. Executes successfully

  3. Run time Error

  4. Logical Error

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

When you redefine a field with a larger picture clause, you're creating an alternate view of storage. Most systems allow this and the code executes, though there may be overlapping memory concerns. Option A (Compilation Error) would occur for syntax violations, and Option C (Run time Error) typically happens during execution for invalid operations.

Multiple choice technology programming languages
  1. %macro hex(start=1, stop=10, incr=1); %local i; data null; %do i=&start to &stop by &incr; value=&i; put "Hexadecimal form of &i is " value hex6.; %end; run; %mend hex;

  2. %macro hex(start=1, stop=10, incr=1); %local i; data null; %do i=&start %to &stop %by &incr; value=&i; put "Hexadecimal form of &i is " value hex6.; %end; run; %mend hex;

  3. %macro hex(start=1, stop=10, incr=1); %local i; data null; %do i=&start to &stop by &incr; value=&i; put "Hexadecimal form of &i is " value hex6.; run; %mend hex;

  4. %macro hex(start=1, stop=10, incr=1); %local i; data null; %do i=&start to &stop by &incr; value=&i; put "Hexadeciaml form of &i is " value hex6.; %end run; %mend hex;

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

In SAS macro loops, the iteration syntax requires percent signs before TO and BY: %DO variable=start %TO stop %BY increment. Options A, C, and D use the incorrect DATA step syntax (to, by without %). Option B correctly uses %TO and %BY, and properly structures the macro with %LOCAL for the loop variable and matching %END. The other options either use wrong syntax or have structural errors (missing %END, misspelling, wrong placement of RUN).

Multiple choice technology programming languages
  1. A %MACRO statement must always be paired with a %MEND statement.

  2. A macro definition can include macro variable references, but it cannot include SAS language statements.

  3. Only macro language statements are checked for syntax errors when the macro is compiled.

  4. Compiled macros are stored in a temporary SAS catalog by default.

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

A %MACRO must always be terminated by %MEND, so that statement is true. Macro definitions can contain SAS language statements, making the claim that they cannot include such statements false. The other statements about syntax checking and temporary catalog storage are true, so the false option is the one marked correct.

Multiple choice technology programming languages
  1. you must place %DO and %END statements around code that describes the conditional action, if that code contains multiple statements.

  2. the %ELSE statement is optional.

  3. you cannot refer to DATA step variables in the logical expression of the %IF statement.

  4. all of the above.

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

In SAS macro programming, multiple statements in a conditional block require %DO and %END. The %ELSE clause is optional, and DATA step variables cannot be directly referenced in macro %IF conditions because macros execute before the DATA step compiler runs. Thus, all statements are correct.

Multiple choice technology programming languages
  1. . Line 1 will not compile

  2. . Line 2 will not compile

  3. . Line 3 will not compile

  4. . Line 4 will not compile

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

Line 1 fails because # is not a valid character to start an identifier in Java - identifiers must begin with a letter, underscore _, or dollar sign $. Line 4 fails because ~ is never valid in an identifier. Lines 2 and 3 compile: \$age (dollar is valid) and _height (underscore is valid) are legal identifiers. The key distinction is the allowed starting characters for Java identifiers.