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
-
Integer
-
Null
-
Object
-
String
A
Correct answer
Explanation
JSON has only six basic data types: string, number, boolean, null, object (array), and array. Integer is not a separate type - numbers in JSON are just "number" (which can be integer or floating-point). Null, Object, and String are valid JSON types. Note that Object here refers to JSON objects (key-value pairs), not Java objects.
-
Alert()
-
Eval()
-
Evale()
-
Console()
B
Correct answer
Explanation
JSON is a subset of JavaScript, and in early implementations, eval() was commonly used to parse JSON strings into JavaScript objects. However, this is now considered a security risk and is deprecated in favor of JSON.parse(). The question reflects historical usage patterns. eval() executes arbitrary JavaScript code, making it dangerous with untrusted JSON.
-
For…NEXT
-
While…Wend
-
Loop
-
Do…While
D
Correct answer
Explanation
Do...While loops evaluate the condition after executing the loop body, ensuring the code inside runs at least once before checking whether to continue. For loops, While loops, and basic Loop statements check conditions before execution.
-
You Can’t
-
OptionDeclare
-
Declare Explicit
-
Option Explicit
D
Correct answer
Explanation
In VBScript (used in QTP/UFT), placing Option Explicit at the top of a script forces the developer to declare all variables before using them.
-
The instance gets garbage collected.
-
The code on line 33 throws an exception
-
The code on line 35 throws an exception.
-
The code on line 31 throws an exception
-
The code on line 33 executes successfully.
B,C,E
Correct answer
Explanation
The finally block (line 37) executes whenever control enters the try block. This happens when line 33 throws an exception (caught at line 34), when line 33 executes normally (no exception), or when line 35 throws an exception (still executes finally before exiting). Garbage collection (line 31 exceptions) don't trigger finally.
-
A. final
-
C. native
-
F. abstract
-
G. protected
A
Correct answer
Explanation
In interfaces, fields are implicitly public, static, and final. Valid modifiers include public, static, and final. The question asks which three are valid but only provides A (final) as correct among the options. Native, abstract, and protected are not valid for interface fields. The claimed answer A is correct, but the question asks to choose three and only one is marked correct.
-
A. final
-
C. native
-
F. abstract
-
G. protected
-
Instance Data
-
Target Data
-
Both
-
None of these
C
Correct answer
Explanation
The Informatica Debugger can debug transformations using either instance data (passing test data through) or target data (from actual target tables). This provides flexibility for testing in different scenarios. Options A and B incorrectly suggest only one mode is available.
-
Precondition
-
Method
-
Transition
-
Iteration
A,C
Correct answer
Explanation
In Pega Activity rules, When Condition rules can be used in Preconditions (to determine if an activity should execute) and Transitions (to control which path to follow after a step). They cannot be used in Methods or Iterations as indicated by options B and D. Options A and C are correct.
-
It will run without error
-
Runtime Error
-
Compilation Error
-
None of all
A
Correct answer
Explanation
The Thread class has a constructor Thread(Runnable target), and Thread itself implements Runnable. Passing a Thread object as the Runnable target is valid syntax - it compiles and runs without error. The new Thread object wraps the existing Thread as its Runnable target.
-
Through the RC keyword
-
Through the CODE keyword
-
Through the COND keyword
-
Through the RETURNCD keyword
C
Correct answer
Explanation
In IBM mainframe JCL (Job Control Language), the COND (Condition) parameter is used to test the return codes of previously executed job steps before deciding whether to execute the current job step.
-
- char
-
- byte
-
- short
-
- int
-
- boolean
A,B,C,D
Correct answer
Explanation
Java switch statements accept integral types that can fit in an int: char, byte, short, and int (and their wrapper classes Character, Byte, Short, Integer). Long and float types are not permitted, and boolean is explicitly excluded.
-
1 This is the pseudocode representing the two types of assert statements:
-
2 Always handle an AssertionError in a try-catch-finally block.
-
3 This is the pseudocode representing the two types of assert statements:
-
4 Assertions of the 'assert booleanExpression;' variety should not be disabled before distributing the software.
-
- The quotes should not be around false.
-
- New should be after Boolean.
-
- A boolean is expected not a Boolean.
-
- The Semi-colon should not be used.
C
Correct answer
Explanation
In Java, you cannot use a Boolean wrapper object directly in an if statement - the condition expects a primitive boolean. The Boolean object must be unboxed (either explicitly via booleanValue() or through auto-unboxing in some contexts). The code fails because 'if (b)' attempts to use the Boolean object as a boolean primitive.