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

Multiple choice technology mainframe
  1. KEYWORD

  2. POSITIONAL

  3. BOTH

  4. NONE

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology mainframe
  1. Operational

  2. Identifier

  3. Parameter

  4. Comment

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology testing
  1. Decision coverage

  2. Condition coverage

  3. Statement coverage

  4. Path Coverage

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology web technology
  1. 2

  2. 4

  3. 3

  4. 1

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology testing
  1. 3

  2. 4

  3. 2

  4. 5

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. Any changes made to the parameter will be reflected in the variable.

  2. The out parameters is used to return values in the same variables, that you pass an an argument of a method

  3. A variable to be sent as OUT parameter must be initialized

  4. 1 & 2

  5. 2 & 3

  6. 1 & 3

Reveal answer Fill a bubble to check yourself
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).

Multiple choice technology programming languages
  1. lazy="true"

  2. lazy="false"

  3. lazy="on"

  4. lazy="off"

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology databases
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology web technology
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology web technology
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology mainframe
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. Handle with try catch block

  2. Handle with Throwable class

  3. Both of above true

  4. None of above

Reveal answer Fill a bubble to check yourself
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.

Multiple choice technology programming languages
  1. Finding length of string

  2. Clearing elements in Vector

  3. Comparing two Strings

  4. None of above

Reveal answer Fill a bubble to check yourself
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.