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
  1. L is recursive

  2. L is recursively enumerable but not recursive

  3. L is not recursively enumerable

  4. Whether L is recursive or not will be known after we find out if P = NP

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

A language L is said to be recursive if there exists any rule to determine whether an element belong to language or not, if language can be accepted by turning machine. So there exist the rules so L is recursive.

Multiple choice
  1. $S\rightarrow AC\mid CB$ $C\rightarrow aCb\mid a\mid b$ $A\rightarrow aA\mid \varepsilon$ $B\rightarrow Bb\mid \varepsilon$
  2. $S\rightarrow aS\mid Sb \mid a\mid b$
  3. $S\rightarrow AC\mid CB$ $C\rightarrow aCb\mid \varepsilon$ $A\rightarrow aA\mid \varepsilon$ $B\rightarrow Bb\mid \varepsilon$
  4. $S\rightarrow AC\mid CB$ $C\rightarrow aCb\mid \varepsilon$ $A\rightarrow aA\mid a$ $B\rightarrow Bb\mid b$
Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Multiple choice
  1. array

  2. constant

  3. integer

  4. double

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

In Visual Basic, the 'To' keyword is used in array declarations to specify a range, like 'Dim arr(1 To 10) As Integer'. This creates an array indexed from 1 to 10. The other options (constant, integer, double) use different declaration syntax without the 'To' keyword.

Multiple choice
  1. Menu

  2. Form

  3. Tool bar

  4. File

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

In Visual Basic, Forms are the fundamental building blocks - they're the windows and dialog boxes that users interact with. Every VB application starts with at least one form. Menus, toolbars, and files are components that live on forms, not the base structure themselves.

Multiple choice
  1. private

  2. public

  3. static

  4. dim

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

The 'Public' keyword declares a variable with global scope, making it accessible from anywhere in the program (across different modules and forms). Private limits scope to its own module, static preserves values between calls, and dim creates local variables. Public enables program-wide availability.

Multiple choice
  1. Menu bar

  2. Project Explorer Window

  3. Tool box

  4. None of these

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

The Project Explorer window in Visual Basic displays a hierarchical tree of all components in your application, including all forms, modules, and class files. Menu bars contain commands, toolboxes contain controls, and 'None of these' is incorrect. Project Explorer is the navigation hub.

Multiple choice
  1. .EXE

  2. .BAS

  3. .VBP

  4. .DOC

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

In Visual Basic 6.0, standard modules use the .BAS file extension. .EXE is for compiled executables, .VBP is the project file itself, and .DOC is a Word document. BAS files contain reusable code procedures and global declarations that aren't tied to specific forms.

Multiple choice
  1. database

  2. visual programming language

  3. operating system

  4. visual art

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

Visual Basic is a visual programming language because it allows developers to create programs visually using a drag-and-drop interface for UI elements, while writing code behind them. It is not a database, operating system, or art form.

Multiple choice
  1. boolean

  2. integer

  3. string

  4. variant

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

The default datatype in Visual Basic is Variant. A Variant can hold any type of data (numbers, strings, dates, etc.) and VB automatically converts between types as needed. If you don't specify a type when declaring a variable, it defaults to Variant.

Multiple choice
  1. Private procedure

  2. Form procedure

  3. Sub procedure

  4. Property procedure

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

Sub procedures in Visual Basic perform actions but do not return a value to the calling code. Unlike Function procedures, Subs are used when you need to execute code without getting a return value.

Multiple choice
  1. command button

  2. list

  3. image box

  4. label

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

AddItem is a method used with list boxes and combo boxes in Visual Basic to add new items to the collection at runtime. It dynamically populates the list with data.

Multiple choice
  1. conditional statements

  2. loop structures

  3. methods

  4. procedures

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

Conditional statements like If...Then...Else allow code to execute different paths based on conditions. This controls program flow by making decisions at runtime. While loops also control flow, conditionals are the primary mechanism for branching logic.

Multiple choice
  1. procedure

  2. event

  3. statement

  4. none of these

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

A procedure is a named block of code that performs a specific task. It encapsulates multiple statements that work together as a unit, making code more organized and reusable.

Multiple choice
  1. Sub procedure

  2. General procedure

  3. Function procedure

  4. Event procedure

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

Function procedures return a value to the calling code using the Return statement or by assigning a value to the function name. This distinguishes them from Sub procedures which do not return values.