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
A
Correct answer
Explanation
VBScript supports only a single data type called Variant, which can contain different types of information depending on how it is used. Because of this, you cannot declare a variable of a specific type like Integer or String. This makes the statement true, rendering the false option incorrect.
-
While … Wend
-
Do While … Loop
-
Do Until … Loop
-
VB Script doesn't have any deprecated loops at all.
B
Correct answer
Explanation
In VBScript (and QTP/UFT), Functions DO return values, while Subroutines do NOT. The statement claims the opposite, which is incorrect. Functions use the function name to return a value, while Subroutines are used for procedures that don't need to return a value.
B
Correct answer
Explanation
In COBOL, PROGRAM-ID is a required paragraph in the IDENTIFICATION DIVISION. Every COBOL program must have a PROGRAM-ID that uniquely identifies the program to the compiler and runtime system. Option A is incorrect because PROGRAM-ID is mandatory, not optional.
B
Correct answer
Explanation
PROGRAM-ID is a mandatory paragraph in COBOL, not optional. Every COBOL program must have a PROGRAM-ID clause in the IDENTIFICATION DIVISION to identify the program to the compiler and system.
-
do i=1 to dim(tmp);
-
do i=1 to dim(*);
-
do i=1,2,3,4;
-
do i=1 to 4;
B
Correct answer
Explanation
The dim function in SAS requires a valid array name as its argument to return the number of elements. Using dim(*) is syntactically invalid and causes an error. In contrast, dim(tmp), a list of explicit indices 1,2,3,4, or the range 1 to 4 correctly reference all four array elements.
-
can be used to manipulate character strings in macro variable values.
-
have the same basic syntax as the corresponding DATA step functions and yield similar results.
-
all of the above
-
none of the above
C
Correct answer
Explanation
Macro character functions in SAS can manipulate character strings in macro variables and share the same syntax as corresponding DATA step functions, yielding similar results. The 'all of the above' option correctly encompasses both characteristics.
-
Unreachable Code
-
Undeclared Variables
-
Faults in requirements
-
Too few comments
C
Correct answer
Explanation
Static analysis tools examine source code without running it, allowing them to detect structural issues like unreachable code, undeclared variables, or insufficient comments. However, they cannot evaluate whether the program meets business needs, meaning faults in requirements can only be identified through dynamic testing or manual reviews.
-
Assign-WorkList
-
Assign-WorkBasket
-
Either
-
None
C
Correct answer
Explanation
An assignment in Pega is an instance of either the Assign-Worklist class (when assigned to an individual operator) or the Assign-Workbasket class (when assigned to a work queue/basket). Therefore, 'Either' is correct.
-
Rule-Message
-
Rule-Error-Message
-
Rule-Set-Message
-
Rule-Obj-Message
A
Correct answer
Explanation
Rule-Message rules define reusable error message text and templates in Pega. These messages are associated with properties or pages to flag validation issues, whereas other listed options are not valid Pega rule types.
-
A rule used to validate that the data entered in a field is an integer.
-
A rule used to ensure that all interested persons are apprised of a work object’s status
-
A rule used to ensure that all required fields are complete.
-
A rule used to validate that a user has the appropriate security to access a part of the application
C
Correct answer
Explanation
A Validation rule in Pega is primarily used to ensure that all required fields are complete and that data meets specified criteria. It does not validate data types (that's done by edit validates), check security permissions, or notify interested parties (that's done by routing).
-
show(byte b){ }
-
show(long l){ }
-
none of the above
-
compilation error
B
Correct answer
Explanation
The literal 10 is an int. Java method overloading selects the most specific applicable method. show(long) is invoked because int can be widened to long, but there is no show(int) or show(byte) that directly matches.
-
when arrays and references are passed
-
only when references are passed
-
args are not changed
-
Command line args are changed
A
Correct answer
Explanation
@, the default array for subroutine arguments, contains aliases to the actual passed elements. When arrays or references are passed, modifying @ changes the original data. For references, this affects the referenced object.
-
1 can only be called with predecleration of complex_num
-
1 and 2 are same
-
2 can only be called with predecleration of complex_num
-
1 is reference to a subroutine
C
Correct answer
Explanation
In Perl, calling a subroutine without the ampersand sigil requires a pre-declaration (or prior definition) to let the compiler parse it properly, whereas using the ampersand allows calling it without such declarations. Therefore, the second syntax relies on pre-declaration, making this option correct.
C
Correct answer
Explanation
AICA is the CICS abend code indicating a task exceeded its maximum execution time, typically caused by an infinite loop or runaway process. APCT indicates a program check exception, ASRB is a storage violation, and ABMB is a mapping error. CICS uses AICA to protect system resources by terminating tasks that run too long.