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 testing
  1. View

  2. Variables

  3. Command

  4. Current

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The Command tab in the Debug Viewer allows you to execute VBScript statements during a debugging session. You can use it to set or modify variable values, test expressions, or execute any VBScript command to understand or manipulate the test state at runtime.

Multiple choice technology architecture
  1. internal change

  2. inter-module change

  3. side effect

  4. side-module update

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

A side effect occurs when a function or module modifies state outside its local scope, such as changing a global variable or modifying data passed by reference. This makes code harder to reason about and test, since the effects aren't contained within the module itself.

Multiple choice technology architecture
  1. the name of array

  2. the data type of array

  3. the first data from the set to be stored

  4. the index set of the array

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Array declarations require the array's name, data type, and index set (bounds), but do not require specifying the actual data values. The first element's value is set later through assignment or initialization, not as part of the declaration itself.

Multiple choice technology architecture
  1. underflow

  2. overflow

  3. housefull

  4. saturated

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

When START=NULL in a linked list, the list is empty. Attempting to delete from an empty data structure is called underflow. Overflow refers to being unable to insert due to lack of space, which is the opposite scenario.

Multiple choice technology mainframe
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

In COBOL, parameter passing is by position, not by name. The calling program's USING clause must pass parameters in the correct sequence expected by the called subprogram, but the field names themselves do not need to match. Only the data types and positions must correspond correctly. This allows different naming conventions between calling and called programs.

Multiple choice technology mainframe
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In the COBOL CALL statement, the USING clause must list parameters in the exact sequence that the called subprogram expects them. Parameter matching is positional - the first parameter in USING corresponds to the first parameter in the called program's linkage section, the second to the second, and so on. This sequence is critical for correct data passing.

Multiple choice technology performance
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Java is generally faster than JavaScript for heavy processing due to its compiled nature, static typing, and optimized JVM. JavaScript is interpreted and dynamically typed, which introduces runtime overhead. For computationally intensive tasks, Java's performance advantages are significant.

Multiple choice technology performance
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Caching frequently accessed object properties in local variables reduces repeated property lookups, which improves performance. Each property access requires the JavaScript engine to traverse the object's prototype chain. Storing the value in a local variable eliminates this overhead, especially in loops.

Multiple choice technology performance
  1. if (x*x < 1000 && y) alert("true!");

  2. if (x*x > 1000 && y) alert("true!");

  3. if (y || x*x > 1000) alert("true!");

  4. if (x*x > 1000 || y) alert("true!");

Reveal answer Fill a bubble to check yourself
A,D Correct answer
Explanation

Given x=10 (so x*x=100), option A evaluates both conditions (100<1000 is true, must check y), and option D evaluates both (100>1000 is false, must check y due to OR). Options B and C short-circuit without full evaluation. The question asks which are SLOWER, meaning more evaluations, so A and D are correct.

Multiple choice technology programming languages
  1. It is allocated at compile time

  2. Declaration and initialization is separated

  3. It is allocated at runtime

  4. All of these

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In C#, readonly variables are allocated when their containing type is loaded, which can be at compile time for constant-like scenarios. The key distinction from const is that readonly fields can be initialized at declaration or in a constructor, while const requires compile-time initialization. Option C contradicts A, and B is a feature (not a defining characteristic), making A the most accurate among the choices.

Multiple choice technology programming languages
  1. No return type for events

  2. Double

  3. Integer

  4. String

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

To answer this question, the user needs to have knowledge about programming events. In programming, an event is an action or occurrence detected by a program, and it can have a return type.

Now, let's go through each option and explain why it is right or wrong:

A. No return type for events: This option is incorrect because events can have a return type. The return type defines what kind of value the event handler method returns when the event is raised.

B. Double: This option is incorrect because the return type of an event depends on the type of data that the event is passing. An event can have a return type of any valid data type, including Double, Integer, String, and others.

C. Integer: This option is incorrect because the return type of an event depends on the type of data that the event is passing. An event can have a return type of any valid data type, including Double, Integer, String, and others.

D. String: This option is incorrect because the return type of an event depends on the type of data that the event is passing. An event can have a return type of any valid data type, including Double, Integer, String, and others.

The Answer is: A. No return type for events

Multiple choice technology programming languages
  1. a interger type to double

  2. a reference type to a value type

  3. a value type to a reference type

  4. a double type to interger

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Boxing is the process of converting a value type (like an int or a struct) to a reference type (like object), allocating the value on the garbage-collected heap. Unboxing is the reverse. Other options describe numeric type casting, making the stored choice correct.