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 programming languages
  1. W

  2. X

  3. Y

  4. Z

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

The sort function arranges the elements in alphabetical order, producing ('W', 'X', 'Y'). The unshift operation then adds 'Z' to the beginning of the array, making it the first element at index 0. Therefore, printing $array[0] displays 'Z'.

Multiple choice technology programming languages
  1. Common Language Runtime

  2. Common Language Routine

  3. Class Library Routine

  4. None

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

CLR stands for Common Language Runtime, which is the execution engine of the .NET Framework. It manages memory execution, thread execution, code safety verification, compilation, and other system services, making it a fundamental component of .NET applications.

Multiple choice technology programming languages
  1. var left-shifted 2 bits

  2. var mutliplied by 2 bits

  3. var reduced 2 bits

  4. None of the above

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

The <<= operator in Bash arithmetic evaluation (let) is the left-shift assignment operator. It shifts the bits of var to the left by 2 positions and assigns the result back to var. This is equivalent to multiplying by 4, not 'multiplied by 2 bits' or 'reduced'.

Multiple choice technology programming languages
  1. ALL , AUTOMATIC , USER

  2. AUTO , SYS , LOCAL

  3. ALL , LOCAL ,USERDEFINED

  4. ALL , AUTO , GLOBAL

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

In SAS, the %put statement supports specific keywords to list macro variables in the log. _ALL_ displays all variables, _AUTOMATIC_ displays SAS-defined automatic variables, and _USER_ displays user-defined variables. Other options contain invalid keywords like _AUTO_ or _USERDEFINED_.

Multiple choice technology programming languages
  1. Referencing a nonexistent macro variable results in a warning message. Referencing an invalid macro variable name results in an error message.

  2. Referencing a nonexistent macro variable results in a error message. Referencing an invalid macro variable name results in an warning message.

  3. Referencing a nonexistent macro variable and invalid macro variable name results in an error message.

  4. Referencing a nonexistent macro variable and invalid macro variable name results in an warning message.

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

In SAS, referencing a nonexistent macro variable generates a warning in the log, and the reference is left unresolved. However, referencing an invalid macro variable name (which violates SAS naming rules, such as starting with a number) violates syntax rules and results in a compilation error.

Multiple choice technology programming languages
  1. It's the same as a constant

  2. It's value can be assigned only once

  3. You can never assign a value to it

  4. You can assign value multiple times

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

A readonly field in C# can only be assigned a value during its declaration or within the class's constructor. Once the constructor finishes, its value becomes immutable. This differs from constants, which must be known at compile-time, and regular variables, which can be reassigned multiple times.

Multiple choice technology programming languages
  1. DLLImport

  2. UsingDLL

  3. DLLCall

  4. CallDLL

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

DllImport is the attribute used in C# to call methods from unmanaged code, including COM objects and native DLLs. The syntax is [DllImport("dllname.dll")] for external method declarations. The other options (UsingDLL, DLLCall, CallDLL) are not valid C# keywords or attributes.

Multiple choice technology programming languages
  1. delegate {TheMethod( int Z) }

  2. delegate void TheMethod(int Z) ;

  3. delegate: TheMethod (int Z)

  4. delegate: {TheMethod (int Z)}

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

The correct delegate declaration syntax in C# is 'delegate returnType MethodName(parameters)'. Option B shows this correctly: 'delegate void TheMethod(int Z)'. The other options use incorrect syntax with braces, colons, or missing return types.

Multiple choice technology web technology
  1. .NET Framework 2.0 CLR was was introduced with VS 2005

  2. .Net Framework 3.0 uses the .NET Framework 2.0 CLR

  3. .Net Framework 3.5 uses the .NET Framework 2.0 CLR

  4. .Net Framework 3.5 SP1 first time introduce the .NET Framework 3.0 CLR

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

.NET Framework versions 2.0, 3.0, and 3.5 all used the same CLR 2.0 runtime. There is no such thing as a '.NET Framework 3.0 CLR' - the runtime versions are CLR 1.x, 2.0, 4.0, and .NET 5+. Statement D falsely claims a 3.0 CLR exists.

Multiple choice technology programming languages
  1. call

  2. this

  3. do

  4. that

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

The this keyword in C# refers to the current instance of the class in which it is used, allowing access to its members. Distractors like call and do are keywords reserved for other operations, while that is not a valid C# keyword for referencing the current object.

Multiple choice technology programming languages
  1. Invoke()

  2. StartInvoke()

  3. BeginInvoke()

  4. SetInvoke()

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

BeginInvoke() is the correct method for asynchronous delegate invocation in C#. It initiates the delegate call on a thread pool thread and returns an IAsyncResult object for tracking. Invoke() executes synchronously, while StartInvoke() and SetInvoke() are not standard C# delegate methods.