Computer Knowledge

Programming Fundamentals

2,381 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 programming languages
  1. Struct

  2. Delegate

  3. string

  4. Enumeration

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

In C#, string is a reference type, not a value type. Value types include structs, enums, and primitive types (int, bool, etc.). Delegates are also reference types. When you assign a string variable, you're copying a reference, not the actual string data.

Multiple choice technology programming languages
  1. string [,,] aMatrix;

  2. string [][][] aMatrix;

  3. int [][]aInt= new int[3][];

  4. None of the above.

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

A jagged array in C# is an array-of-arrays where each inner array can have different lengths. The syntax int [][]aInt = new int[3][]; creates a jagged array with 3 rows, where each row can be initialized separately with different lengths. Option A is a 3D rectangular array. Option B is also rectangular. Jagged arrays use [][] syntax.

Multiple choice technology programming languages
  1. string [,,] aMatrix;

  2. string [][][] aMatrix;

  3. int [][]aInt= new int[3][];

  4. None of the above.

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

A jagged array in C# is an array-of-arrays where each inner array can have different lengths. The syntax uses two sets of brackets: 'int[][]' or 'int[][] = new int[3][]'. Option C shows this correctly. Options A and B are rectangular/multi-dimensional arrays (commas between brackets), not jagged arrays. Jagged arrays are declared and initialized with '[]' syntax, not '[,,]' syntax.

Multiple choice technology programming languages
  1. Struct

  2. Delegate

  3. string

  4. Enumeration

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

In C#, value types are primitive types that store data directly. Struct, Delegate, and Enumeration are all value types. string is a reference type - it's an object that stores a reference to the actual string data on the heap, not the data itself.

Multiple choice technology programming languages
  1. The code on line 31 throws an exception

  2. The code on line 33 throws an exception

  3. The code on line 35 throws an exception

  4. The code on line 33 executes successfully

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

The finally block on line 37 always executes regardless of how the try-catch block exits. This includes successful execution of the try block (line 33), or when an exception is thrown in the try block (line 33) or catch block (line 35).

Multiple choice technology mainframe
  1. Always returns a value.

  2. Never returns a value.

  3. Returns when RC is coded

  4. I am skipping this!!

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

In REXX, the EXIT instruction terminates the program immediately. It can optionally return a value to the caller (such as the operating system or another script) if an expression or a Return Code (RC) variable is provided. Without an expression, it returns no value. The other options are incorrect because returning a value is optional, not mandatory or impossible.

Multiple choice technology mainframe
  1. DROP

  2. DELSTACK

  3. DELETE

  4. Cant delete a stack

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

DELSTACK is the REXX command to delete/remove a stack. DROP is for variables, DELETE isn't used for stacks, and stacks can be deleted.

Multiple choice technology web technology
  1. serialization

  2. garbage collection

  3. assemblies

  4. overriding

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

Garbage collection is the automatic memory management technique in .NET framework that automatically reclaims memory occupied by objects that are no longer in use. Serialization is about object persistence, assemblies are deployment units, and overriding is a polymorphism concept - none relate to memory management.