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
-
KEYWORD
-
POSITIONAL
-
BOTH
-
NONE
B
Correct answer
Explanation
POSITIONAL parameters in JCL are interpreted by the operating system based strictly on their order - the first positional parameter maps to the first expected parameter, the second to the second, etc. Their meaning depends entirely on position. KEYWORD parameters (NAME=value) are self-identifying and order-independent. The question specifically asks which type is 'interpreted based on the order', which describes positional parameters.
-
Operational
-
Identifier
-
Parameter
-
Comment
B
Correct answer
Explanation
The identifier (or name) field is the first field in a JCL statement, beginning with //. This field identifies the statement and gives it a name that can be referenced by other statements. It appears before the operation, parameter, and comment fields in the standard JCL statement structure.
-
Decision coverage
-
Condition coverage
-
Statement coverage
-
Path Coverage
B
Correct answer
Explanation
The compound condition condition1 && (condition2 || function1()) contains multiple atomic conditions that can be independently true or false. Condition coverage requires testing each atomic condition for both true and false values, which is necessary here since we have condition1, condition2, and the return value of function1(). Decision coverage would only test the overall if/else decision (true/false), statement coverage would only ensure each statement is reached, and path coverage would test all possible paths through the code which is more comprehensive than needed.
A
Correct answer
Explanation
.NET has two levels of compilation. First, the language compiler (like C# or VB.NET) converts source code to Intermediate Language (IL). Second, the JIT compiler converts IL to native machine code at runtime. This two-stage process enables cross-language integration.
A
Correct answer
Explanation
QTP/UFT has three main parameter types: Test/Action parameters (for passing values into actions), Data Table parameters (for data-driven testing using the DataTable), and Environment parameters (for external/environment variables). These three types cover the primary parameterization needs in QTP.
-
Any changes made to the parameter will be reflected in the variable.
-
The out parameters is used to return values in the same variables, that you pass an an argument of a method
-
A variable to be sent as OUT parameter must be initialized
-
1 & 2
-
2 & 3
-
1 & 3
D
Correct answer
Explanation
In C#, OUT parameters allow methods to return values through the same variables passed as arguments. Any changes to the parameter are reflected in the calling variable, and importantly, variables passed as OUT do NOT need to be initialized before being passed (unlike 'ref' parameters).
-
lazy="true"
-
lazy="false"
-
lazy="on"
-
lazy="off"
A
Correct answer
Explanation
Batch fetching is an optimization strategy to reduce the number of SELECT queries (solving the N+1 selects problem) specifically when lazy loading (lazy="true") is enabled. If lazy loading is disabled (lazy="false"), entities are fetched eagerly, rendering batch fetching irrelevant. Options with 'on' and 'off' are invalid syntax.
B
Correct answer
Explanation
The SIMPLE_INTEGER datatype in Oracle (introduced in 11g) is a subtype of PLS_INTEGER that does not allow NULL values. It's designed for performance-critical code where NULL handling overhead is unwanted. SIMPLE_INTEGER always ranges from -2,147,483,648 to 2,147,483,647 and cannot be NULL.
B
Correct answer
Explanation
System.Array is a strongly-typed collection in .NET. When you declare an array, you must specify the type of elements it will contain (e.g., int[] or string[]). Once declared, an array can only store elements of that specific type. To store multiple types, you'd need an object[] or an ArrayList/collection.
A
Correct answer
Explanation
True is correct because when an exception is thrown in a try block, only the first matching catch block will execute. Once a catch block handles the exception, control passes to that block and subsequent catch blocks are skipped. This is why catch blocks must be ordered from most specific to most general exception types to ensure the correct handler is chosen.
B
Correct answer
Explanation
REDEFINES and OCCURS cannot both be specified at the same level number in a COBOL data description entry. REDEFINES must be at the same level as the item being redefined, while OCCURS creates a table/array. To use both, you would typically use REDEFINES at one level and have OCCURS in a subordinate level within the redefined item.
-
DS
-
DC
-
No such instruction exists.
-
Both 1 and 2
-
Handle with try catch block
-
Handle with Throwable class
-
Both of above true
-
None of above
D
Correct answer
Explanation
Compile-time errors (checked exceptions) must be handled at compile time through declaration or catching. They cannot be handled with try-catch at runtime because the compiler enforces their handling before the code can run. Throwable is the superclass of all errors and exceptions but doesn't apply here.
-
Finding length of string
-
Clearing elements in Vector
-
Comparing two Strings
-
None of above
C
Correct answer
Explanation
The intern() method in Java's String class is used to return a canonical representation of the string from the string pool. It's primarily used for string comparison optimization - interned strings can be compared using == reference equality instead of equals() for content comparison.
-
NULLIF
-
LENGTH
-
CONCAT
-
INSTR
C
Correct answer
Explanation
CONCAT ignores NULL arguments and returns the non-NULL value, making it the correct choice. NULLIF returns NULL when its two arguments are equal, LENGTH returns NULL when given NULL, and INSTR also returns NULL with NULL inputs.