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
-
Spaces, tabs & linefeeds
-
Kernel
-
Haskell
-
Nutshell
D
Correct answer
Explanation
Python is well-known for using significant whitespace (indentation) to define block structure, unlike languages like Java, C++, or Cobra that use braces/end keywords. Python's syntax relies on consistent indentation for nested blocks, making it the correct answer. Options A, B, C use brace-based syntax.
D
Correct answer
Explanation
In ASP, server-side code is represented using <% and %> delimiters, often written as <%%> to denote the opening and closing tags together. Options A, B, and C use incorrect syntax that would not be recognized by the ASP engine.
-
Compiled
-
Interpreted
-
Both
-
None
B
Correct answer
Explanation
Perl is primarily an interpreted language, though Perl scripts can be compiled to bytecode. Unlike C or Java which are compiled to native code, Perl code is typically executed by the Perl interpreter. Option B correctly identifies Perl as interpreted.
-
Practically Extracted Reporting Language
-
Practical Extraction report Language
-
Practical Extraction and report Language
-
Practical Export and report Language
C
Correct answer
Explanation
Perl officially stands for 'Practical Extraction and Reporting Language'. Option C has the exact wording. Options A and B have 'Extracted' instead of 'Extraction' and missing 'and'. Option D uses 'Export' which is incorrect.
-
Modules
-
Classes
-
Packages
-
Libraies
A
Correct answer
Explanation
Perl libraries are called modules and use .pm extension. Modules are packages defined in separate files that can be imported into your Perl scripts using use or require statements.
-
Complete
-
Easy to use
-
Efficient
-
Not agreed with above three
A,B,C
Correct answer
Explanation
Perl's practical design philosophy emphasizes being complete (full-featured), easy to use (familiar syntax for C/sed/awk users), and efficient (fast execution). The combination makes it practical for real-world tasks.
A
Correct answer
Explanation
Perl's most popular use historically was CGI scripting for dynamic web page generation. Before modern frameworks, Perl powered millions of dynamic websites through its powerful text processing capabilities.
-
Replace the copybook with another.
-
The option is invalid with copy statement.
-
It allows for the same copy to be used more than once in the same code by changing the replace value.
-
Has no impact.
C
Correct answer
Explanation
The REPLACING option allows text substitution in copybooks, enabling the same copybook to be used multiple times with different values by changing what gets replaced during compilation. It does not replace the entire copybook (A), is valid with COPY statement (B is wrong), and definitely has an impact.
-
Occurs clause in 01 cant be done because 01 is the top most level.
-
Who said so, you can use it, I bet!
-
Occurs clause is there to repeat fields with same format, not the records.
-
Stack will over flow.
C
Correct answer
Explanation
While the OCCURS clause is technically permitted at 01 level in COBOL, the reasoning in option C correctly identifies its semantic purpose - OCCURS is designed to repeat fields within a record structure, not entire records. Options A and B are incorrect explanations. Stack overflow (D) is irrelevant.
-
Yes
-
No
-
X(245) can be refined to X(250)
-
Author should learn COBOL
A
Correct answer
Explanation
REDEFINES allows redefining a data item with another of equal or smaller length. Redefining X(250) with X(245) is valid - the smaller length is permitted. The reverse (X(245) to X(250)) would not be allowed.
-
Subscript
-
Index
-
Either
-
Author should learn COBOL
-
CreatePage = New Pages
-
New CreatePage = Pages()
-
Set CreatePage = New Pages
-
Dim CreatePage = New Pages
C
Correct answer
Explanation
VBScript requires the 'Set' keyword when assigning object references. The correct syntax is 'Set CreatePage = New Pages'. Options A and B use incorrect syntax without Set or with wrong keyword order, and Dim cannot be combined with New in the same statement.
B
Correct answer
Explanation
C# does not support multiple inheritance with classes - a class can only inherit from one base class. However, C# does support multiple inheritance through interfaces (a class can implement multiple interfaces). The statement refers to class inheritance, which is not supported.
A
Correct answer
Explanation
C# uses XML documentation comments (///) that are conceptually similar to Javadoc's /** */ syntax. Both systems allow embedding documentation directly in source code that can be extracted into formatted HTML documentation. Option D 'Cdoc' is not a real documentation system.