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. True

  2. False

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

C# does not support multiple inheritance of classes. While it supports multiple inheritance through interfaces, the statement about multiple inheritance of classes is false.

Multiple choice technology mainframe
  1. Input Output

  2. Working Storage

  3. Linkage Sction

  4. File section

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

In COBOL, Data Division contains sections for handling file operations and data storage. Working Storage Section holds program variables and temporary data, File Section describes files used by the program, and Linkage Section contains data passed to/from subprograms. Input Output Section does not exist as a standard section in COBOL Data Division.

Multiple choice technology programming languages
  1. empty string

  2. 20

  3. 0

  4. error

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

The code copies string 'name' to dynamically allocated memory with memset. However, the while loop increments p2 after copying the null terminator. After copying ends, p2 points to the null terminator byte, not the start of the copied string. When printf prints from p2, it prints an empty string since p2 now points to the null character.

Multiple choice technology programming languages
  1. Two lines with “Cisco Systems” will be printed.

  2. Compile error

  3. run time error

  4. Cisco Systemsn

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

The code has an if statement that only affects the first printf call. The second printf is outside the if block, so it executes regardless of the condition. Since if(a==0) is true, the first printf executes and prints 'Cisco Systems', then the second printf also executes and prints another line with 'Cisco Systems', resulting in two identical lines.

Multiple choice technology programming languages
  1. C language

  2. Java Language

  3. C# language

  4. B language

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

To solve this question, the user needs to know the concept of subsets, i.e., a subset is a part of a larger set. The user must identify which language(s) are a subset of C++.

Now, let's go through each option and explain why it is right or wrong:

A. C language: This option is correct. C++ is an extension of the C language, which means that all C programs are also C++ programs. Therefore, C is a subset of C++.

B. Java Language: This option is incorrect. Java is not a subset of C++. Although both languages share some similarities, they are distinct programming languages with different syntax and features.

C. C# language: This option is incorrect. C# is not a subset of C++. C# is a programming language developed by Microsoft and is not related to C++.

D. B language: This option is incorrect. B language is not a subset of C++. B language was developed in the early 1970s and is not widely used today.

The Answer is: A. C language

Multiple choice technology programming languages
  1. Statically typed language

  2. Dynamically typed language

  3. Both Statically and dynamically typed language

  4. Type-less language

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

C++ is a statically typed language, meaning variable types are checked and enforced at compile time. This is different from dynamically typed languages where types are checked at runtime. The language is neither type-less nor both statically and dynamically typed.

Multiple choice technology programming languages
  1. Abstract

  2. Virtual

  3. Dynamic

  4. Typeid

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

Virtual keyword in C++ enables dynamic method resolution through virtual functions and polymorphism. Virtual functions allow methods to be overridden in derived classes and the correct method to be called at runtime based on the actual object type. Abstract, Dynamic, and Typeid serve different purposes - abstract for pure virtual functions, typeid for type information.

Multiple choice technology programming languages
  1. Exception Handling

  2. Reflection

  3. Operator Overloading

  4. Namespaces

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

C++ does not support reflection natively. Exception handling is supported via try-catch blocks, operator overloading is a core feature allowing operators to be redefined for user-defined types, and namespaces are supported to organize code. Reflection would require runtime type information that isn't part of standard C++.

Multiple choice technology programming languages
  1. X(X arg)

  2. X(X* arg)

  3. X(const X* arg)

  4. X(const X& arg)

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

A copy constructor in C++ must take a constant reference to the same class type. It uses X(const X& arg) to avoid unnecessary copying and allow passing both lvalues and rvalues. The other options use pointer syntax which would create different constructor signatures and not serve as copy constructors.

Multiple choice technology programming languages
  1. C++ programs are directly compiled into native code by a compiler

  2. C++ programs are first compiled to intermediate code by a compiler and then executed by a virtual machine

  3. C++ programs are interpreted by an interpreter

  4. A C++ editor directly compiles and executes the program

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

C++ is a compiled language that directly translates source code into native machine code without an intermediate bytecode step. Unlike Java or C#, which use virtual machines to execute intermediate code, C++ compilers generate platform-specific executables. Editors are development tools, not execution mechanisms.

Multiple choice technology platforms and products
  1. True

  2. False

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

Rule Resolution in Pega is the mechanism that selects the best rule to execute based on factors like class hierarchy, rule set availability, circumstance, and other criteria. It applies to rule types that can have multiple versions targeting different contexts, like Declare-OnChange, Declare-Constraints, Declare-Trigger. Rule-HTML-Property is a UI rule that defines how a property is displayed and is selected directly by its class and rule set - it does not participate in rule resolution.

Multiple choice technology platforms and products
  1. ps

  2. py

  3. px

  4. pz

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

In Pega, property names with the 'py' prefix indicate standard properties that are part of the Pega platform and can be updated through user input. Other prefixes like 'px' are reserved for Pega internal use, 'pz' for inherited properties, and 'ps' for specialized purposes.