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
-
L is recursive
-
L is recursively enumerable but not recursive
-
L is not recursively enumerable
-
Whether L is recursive or not will be known after we find out if P = NP
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.
-
$S\rightarrow AC\mid CB$
$C\rightarrow aCb\mid a\mid b$
$A\rightarrow aA\mid \varepsilon$
$B\rightarrow Bb\mid \varepsilon$
-
$S\rightarrow aS\mid Sb \mid a\mid b$
-
$S\rightarrow AC\mid CB$
$C\rightarrow aCb\mid \varepsilon$
$A\rightarrow aA\mid \varepsilon$
$B\rightarrow Bb\mid \varepsilon$
-
$S\rightarrow AC\mid CB$
$C\rightarrow aCb\mid \varepsilon$
$A\rightarrow aA\mid a$
$B\rightarrow Bb\mid b$
-
Recursive descent parser.
-
Operator precedence parser
-
An LR(k) parser.
-
An LALR(k) parser.
-
array
-
constant
-
integer
-
double
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.
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.
-
private
-
public
-
static
-
dim
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.
-
Menu bar
-
Project Explorer Window
-
Tool box
-
None of these
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.
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.
-
database
-
visual programming language
-
operating system
-
visual art
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.
-
boolean
-
integer
-
string
-
variant
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.
-
Private procedure
-
Form procedure
-
Sub procedure
-
Property procedure
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.
-
command button
-
list
-
image box
-
label
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.
-
conditional statements
-
loop structures
-
methods
-
procedures
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.
-
procedure
-
event
-
statement
-
none of these
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.
-
Sub procedure
-
General procedure
-
Function procedure
-
Event procedure
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.