Computer Knowledge
Programming Fundamentals
2,611 Questions
Programming fundamentals form the core logic of software development and computer science. This includes variable declarations, pointer assignments, loop iterations, and exception handling. These technical topics are regularly tested in computer knowledge and IT officer competitive examinations.
Variables and arraysPointer assignmentsLoop iterationsException handling blocksCompile time errorsFunction references
Programming Fundamentals Questions
B
Correct answer
Explanation
A const pointer (int* const) cannot be reassigned after initialization, including assignment to NULL. The const qualifier applies to the pointer itself, not the data it points to. Once initialized to an address, the pointer value is fixed.
-
Pointers
-
Friend Function
-
Access Specifiers
-
None
B
Correct answer
Explanation
A friend function in C++ is granted access to the private and protected members of a class. Because it bypasses the standard access control restrictions, it violates the core object-oriented principle of encapsulation.
D
Correct answer
Explanation
C++ structures have significant differences from C structures: they can have member functions, access specifiers (public/private/protected), constructors and destructors, support inheritance and polymorphism, and can be used as template parameters. These represent fundamental extensions beyond C's simpler struct model.
A
Correct answer
Explanation
Transparent Control Statements (TCS) in ECL indeed begin with @@. This is the defining characteristic that distinguishes them from regular ECL statements. The @@ prefix signals the ECL compiler to process these as control flow statements rather than standard code execution.
-
The simple PERFORM statement
-
The PERFORM with TIMES option
-
The PERFORM with UNTIL option
-
The PERFORM with VARYING option
A
Correct answer
Explanation
A simple PERFORM statement executes the target paragraph exactly once and transfers control. In contrast, the TIMES, UNTIL, and VARYING options are designed for looping, which can cause the paragraph to execute multiple times, making the simple statement the correct choice.
-
If statements
-
Evaluate
-
Perform statement
-
Copy statement
B
Correct answer
Explanation
In COBOL, the EVALUATE statement functions like a switch or case structure, allowing multiple alternative paths of execution based on conditions. Distractors like PERFORM, COPY, or IF statements do not match this specific definition or syntax for handling multiple branches cleanly.
B
Correct answer
Explanation
Context-sensitive Declarative Expressions are used for embedded data, not context-free ones. Context-free expressions operate on pages and properties but don't have the context awareness needed for embedded data processing.
-
Local variables can be passed between activities
-
You cannot view local variables and their values in the tracer tool
-
You cannot view the contents of the parameter page in the clipboard viewer
-
You can view parameters and their values in the tracer tool
A
Correct answer
Explanation
Local variables are limited to the execution scope of a single activity and cannot be passed between different activities. The other statements are true: local variables cannot be traced in Tracer, and parameter pages are not visible in the clipboard viewer, making the first statement the false one.
-
Voids
-
Records
-
Vectors
-
Unions
A
Correct answer
Explanation
Voids represent the absence of a value or return type, not a compound data structure. Records, Vectors, and Unions are all compound types that can contain multiple elements or fields, while Void is a primitive/atomic concept.
-
At Compile time
-
At Run time
-
At Both compile time and run time
-
Never
B
Correct answer
Explanation
Job parameters in DataStage are set at runtime when executing a job. This allows flexibility to control job behavior dynamically without modifying the job design. Compile time is incorrect because parameter values are not fixed during compilation.
A
Correct answer
Explanation
In Ab Initio graphs, a formal parameter is a parameter defined in a graph parameter that can be overridden or overwritten by the user when the graph is executed. This allows for flexible configuration without modifying the graph itself. Actual parameters are the values passed in, while formal parameters are the placeholders that accept them.
-
Abort on first reject
-
Never abort
-
Abort on predefiend event
-
Use limit/ramp
C
Correct answer
Explanation
In Ab Initio components with reject handling (like Rollup or Join), the defined reject tolerances are 'Abort on first reject', 'Never abort', and 'Use limit/ramp'. 'Abort on predefined event' is NOT a standard reject tolerance option in Ab Initio components. Note: The option has a typo ('predefiend' instead of 'predefined'), but this doesn't change the answer - the option itself doesn't exist as a standard tolerance.
-
1001
-
error
-
Head First JavaScript
-
id
A
Correct answer
Explanation
The Book constructor function creates objects with id and name properties using 'this'. When called with 'new Book("1001", "Head First JavaScript")', it creates an object where book.id = "1001" and book.name = "Head First JavaScript". The alert(book.id) correctly outputs "1001". Option B (error) is wrong because this is valid constructor syntax.
-
Option Declare
-
Option Explicit
-
Option Mandate
-
None
B
Correct answer
Explanation
Using Option Explicit at the start of a VBScript file forces the developer to declare all variables before using them, preventing typos and bugs. Statements like Option Declare and Option Mandate do not exist in VBScript syntax, making them incorrect distractors.