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
-
Hierarchical
-
Structured
-
object oriented
-
Reporting
B,D
Correct answer
Explanation
Natural has two primary programming modes: Structured mode (uses block structures like IF, LOOP) and Reporting mode (generates reports with LIST, DISPLAY statements). Object-oriented is not a Natural programming paradigm, and Hierarchical is not a recognized mode in Natural.
-
Search
-
Search ALL
-
In-Line Perform
-
All of the above
C
Correct answer
Explanation
For tables with fewer than 20 elements, an inline PERFORM VARYING is more efficient than binary search methods like SEARCH ALL. The overhead of setting up a table index for SEARCH/SEARCH ALL outweighs benefits for small datasets. Inline perform provides simple sequential access without additional table setup requirements.
-
01 is record level
-
No multiple record level fields
-
Occurs repeat the fields only
-
All of the above
D
Correct answer
Explanation
The OCCURS clause cannot be used at 01 level because 01 represents the record definition itself, not a repeating field within a record. Multiple 01-level entries define separate record formats, not repeated fields. OCCURS is designed to repeat data items within a record structure, not repeat entire records. All these reasons combine to make 01-level OCCURS invalid in COBOL.
-
Visual Basic
-
Visual C++
-
Visual C#
-
Visual F#
-
None of the Above
E
Correct answer
Explanation
Visual Studio 2010 supported all the listed languages: Visual Basic, Visual C++, Visual C#, and Visual F#. F# was actually introduced as a first-class language in VS 2010. Therefore 'None of the Above' is correct because all the mentioned languages ARE supported.
-
ERROR RECOVERY
-
ROLLBACK
-
Any one of the above
-
Both of the above
D
Correct answer
Explanation
In COBOL ENVIRONMENT DIVISION, programs (not subroutines) should have both ERROR RECOVERY and ROLLBACK paragraphs. These paragraphs handle error conditions and transaction recovery. The question follows COBOL mainframe programming standards where recovery sections are required for robust program execution.
-
ERROR RECOVERY
-
ROLLBACK
-
None of the above
-
Both of the above
A
Correct answer
Explanation
In certain enterprise COBOL programming schemas, the subroutine structure requires the ERROR RECOVERY paragraph in the ENVIRONMENT DIVISION to handle execution-time anomalies and provide structured recovery blocks, distinguishing it from standard programs which do not enforce this section.
-
ERROR RECOVERY
-
ROLLBACK
-
Any one of the above
-
Both of the above
D
Correct answer
Explanation
A program (not a subroutine) in the ENVIRONMENT DIVISION should have both ERROR RECOVERY and ROLLBACK paragraphs (D). ERROR RECOVERY handles exceptional conditions, while ROLLBACK manages transaction rollback on failure. Having both ensures comprehensive error handling and data integrity. Either one alone is insufficient.
-
Output Control Work
-
Output Control Word
-
Output Common Word
-
Output Common Work
B
Correct answer
Explanation
In microprocessor and I/O systems, OCW stands for Output Control Word, which is used to control the operation of output devices or ports. The Output Control Word configures how the system interfaces with external hardware.
A
Correct answer
Explanation
This code uses XOR swap algorithm. a=10, b=20. After a=a^b: a=30, b=20. After b=a^b: a=30, b=10. After a=a^b: a=20, b=10. The XOR operation reverses the swap in the last step, effectively exchanging the values. This is a classic technique for swapping without a temporary variable.
-
JavaScript
-
LiveScript
-
WireScript
-
ECMAScript
B
Correct answer
Explanation
JavaScript was originally named LiveScript when it was developed by Netscape. It was renamed to JavaScript as a marketing move to capitalize on Java's popularity. ECMAScript is the official standard name, not the original name. WireScript is not related.
-
S9(04) COMP
-
S9(04) COMP-3 SIGN LEADING
-
COMP-1 SIGN LEADING
-
S9(04) COMP-3
A
Correct answer
Explanation
The correct answer is A (S9(04) COMP). COMP stores numbers in binary format which is more space-efficient than COMP-3 (packed decimal). For a 4-digit number like +3473, COMP uses only 2-4 bytes depending on the platform, while COMP-3 would use at least 3 bytes. The binary format is the most compact representation, making it best when memory conservation is the priority.
A
Correct answer
Explanation
In Hibernate XML configuration files, the `element maps a Java class field to a table column. Thename` attribute represents the property name in the Java class, which makes the syntax valid even if it violates standard Java naming conventions.
-
SY-INDEX
-
SY-DBCNT
-
SY-RECNO
-
SY-TABIX
-
SY-LNCNT
B
Correct answer
Explanation
In ABAP, sy-dbcnt is the system field that stores the number of database table rows affected or returned by the last SQL statement. sy-index is the loop iteration counter, sy-tabix is the index of the current line in an internal table, and sy-lncnt relates to printing line counts.
-
For loop
-
While loop
-
Recursion
-
All of these
C
Correct answer
Explanation
For a programming language to be Turing-complete and useful, recursion (or equivalent iteration capability) is theoretically necessary. Loops are convenience features, not theoretical requirements.
A
Correct answer
Explanation
When creating an ABAP program, the required attributes are Type and Title. Application specifies where the program belongs and Status tracks its lifecycle stage, but neither is mandatory. A program can exist without an assigned application or status designation.