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
-
The simple PERFORM statement
-
The PERFORM with TIMES option
-
The PERFORM with UNTIL option
-
The PERFORM with VARYING option
A
Correct answer
Explanation
A simple PERFORM statement executes the target paragraph exactly once and transfers control. In contrast, the TIMES, UNTIL, and VARYING options are designed for looping, which can cause the paragraph to execute multiple times, making the simple statement the correct choice.
-
If statements
-
Evaluate
-
Perform statement
-
Copy statement
B
Correct answer
Explanation
In COBOL, the EVALUATE statement functions like a switch or case structure, allowing multiple alternative paths of execution based on conditions. Distractors like PERFORM, COPY, or IF statements do not match this specific definition or syntax for handling multiple branches cleanly.
-
UML to Java
-
UML to C
-
UML to C++
-
None of the above
A
Correct answer
Explanation
Round-trip engineering allows reversing transformations between UML and Java because Java preserves enough structure to reconstruct the UML. C lacks this expressiveness - its low-level constructs and procedural nature lose UML semantic information irreversibly. The same applies to C++.
C
Correct answer
Explanation
IBM Rational Software Architect (RSA) provides built-in UML transformations for commonly used languages and standards like C++, Java, and WSDL. SmallTalk is an older object-oriented language that is not typically supported out of the box in modern RSA versions due to its limited industry adoption today. The transformation requires additional plugins or custom configuration.
-
Low Level Language
-
High Level Language
-
Machine Level Language
-
Binary Level Language
B
Correct answer
Explanation
SAS is a high-level software suite/programming language designed for advanced analytics, data management, and business intelligence, shielding users from hardware-level complexity. Low-level, machine, and binary languages represent instructions directly executed by CPU architectures.
-
Directed Inheritance
-
Pattern Inheritance
-
Class Inheritance
-
Genetic Inheritance
B
Correct answer
Explanation
In PegaRULES Process Commander, pattern inheritance relies on alphabetical class naming where classes inherit from parent classes that match their name pattern. The Class Explorer's alphabetical view reveals this pattern inheritance structure. Direct inheritance follows explicit parent-child relationships instead.
-
C
-
C++
-
PASCAL
-
FORTAN
-
TAL
-
All of the above
F
Correct answer
Explanation
COBOL 85 programs can invoke routines written in multiple programming languages including C, C++, Pascal, and Fortran through language interop capabilities. The TAL (Transaction Application Language) is also supported in HP NonStop environments. Therefore, all of these languages can be called from COBOL.
B
Correct answer
Explanation
In COBOL, PROGRAM-ID is a required paragraph in the IDENTIFICATION DIVISION. Every COBOL program must have a PROGRAM-ID that uniquely identifies the program to the compiler and runtime system. Option A is incorrect because PROGRAM-ID is mandatory, not optional.
-
C
-
C++
-
PASCAL
-
FORTAN
-
TAL
-
All of the above
F
Correct answer
Explanation
COBOL 85 supports calling routines written in other programming languages through Language Environment (LE) and inter-language communication interfaces. This includes C (for system-level operations), C++ (through appropriate interfaces), Pascal, Fortran (misspelled as 'FORTAN' in option D), and TAL (Tandem Application Language, a system programming language for Tandem/NonStop systems). Therefore, all of these languages can be invoked from COBOL 85.
B
Correct answer
Explanation
PROGRAM-ID is a mandatory paragraph in COBOL, not optional. Every COBOL program must have a PROGRAM-ID clause in the IDENTIFICATION DIVISION to identify the program to the compiler and system.
-
do i=1 to dim(tmp);
-
do i=1 to dim(*);
-
do i=1,2,3,4;
-
do i=1 to 4;
B
Correct answer
Explanation
The dim function in SAS requires a valid array name as its argument to return the number of elements. Using dim(*) is syntactically invalid and causes an error. In contrast, dim(tmp), a list of explicit indices 1,2,3,4, or the range 1 to 4 correctly reference all four array elements.
-
can be used to manipulate character strings in macro variable values.
-
have the same basic syntax as the corresponding DATA step functions and yield similar results.
-
all of the above
-
none of the above
C
Correct answer
Explanation
Macro character functions in SAS can manipulate character strings in macro variables and share the same syntax as corresponding DATA step functions, yielding similar results. The 'all of the above' option correctly encompasses both characteristics.
-
System creates private ruleset automaticaly when needed
-
instance of the Rule-Ruleset-Name class exists for a private RuleSet
-
name of this RuleSet is the same as their Operator ID
-
None
B
Correct answer
Explanation
A private ruleset (used for personal checkouts) is automatically managed by the system. Crucially, no actual Rule-Ruleset-Name instance is created in the database for a private ruleset, making the statement false and therefore the correct answer.
-
Job Circuit Language
-
JCL Control Language
-
Job Control Language
-
JCL Course Language
C
Correct answer
Explanation
JCL stands for Job Control Language, which is used on IBM mainframe systems to define jobs and tell the operating system what resources are needed. Option A incorrectly suggests 'Circuit' instead of 'Control'. Option B is redundant ('JCL Control Language' would repeat 'Control'). Option D incorrectly suggests 'Course' rather than 'Control'.
A
Correct answer
Explanation
COBOL (Common Business-Oriented Language) was developed in 1959 by the CODASYL committee to address business programming needs. It is classified as a high-level language because it uses English-like syntax and abstracts away low-level machine details, making it readable and maintainable.