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 web technology
  1. Interger,String and Date

  2. Interger,String and float

  3. Interger,String and bool

  4. Decimal,String and Date

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

The ASP.NET RangeValidator control supports five data types for validation: String, Integer, Double, Date, and Currency. The selected option correctly lists Integer, String, and Date as supported types, while other options incorrectly include unsupported types like float or bool.

Multiple choice technology performance
  1. a.Sequential

  2. b.Sequential & Unique

  3. c.Sequential & Random

  4. d.Sequential, Random and Unique

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

When a block contains multiple actions, they can be executed either sequentially (in order) or randomly. Both Sequential and Random are valid execution properties. Unique applies to parameter selection, not action execution order.

Multiple choice technology programming languages
  1. The switch & case statement

  2. ?:(ternary operator)

  3. The nestedif statement

  4. The #endif Statement

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

The switch-case statement is specifically designed to replace multiple if-else statements when comparing a single value against multiple possible constants. It provides cleaner, more readable code for this scenario. The ternary operator (?:) is for simple conditional expressions, not multi-way branching. Nested if statements are what we're trying to avoid. #endif is a preprocessor directive for conditional compilation, not runtime logic.

Multiple choice technology programming languages
  1. continue;

  2. break;

  3. return "Infant";

  4. return 0;

  5. return;

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

The question asks about fixing a compiler error by inserting a statement as the last line. While the full code context isn't visible, the correct answer is 'return "Infant";' which suggests the function expects a string return type. 'continue' and 'break' are used within loops, not as function exits. 'return 0' would be incorrect if the return type is string. 'return;' without a value is for void functions. The string return matches the likely function signature.

Multiple choice technology programming languages
  1. True

  2. False

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

In C#, the default underlying type of enum members is int, but the default value of the first enum member is 0, not 1. Unless explicitly assigned, enum constants start at 0 and increment by 1. For example: enum Color { Red, Green, Blue } means Red=0, Green=1, Blue=2. The statement incorrectly claims the default value is 1.

Multiple choice technology programming languages
  1. True

  2. False

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

In C#, only one catch block executes for a single try statement. When an exception occurs, the runtime searches for the first matching catch block and executes it - other catch blocks are skipped even if they would also match the exception type. To handle multiple exception types, you need either multiple catch blocks in sequence (only one executes) or catch a base exception type and check the specific type within.

Multiple choice technology platforms and products
  1. Optional arguments

  2. Named arguments

  3. Positional Parameters

  4. None of the above

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

Named arguments allow you to specify arguments by parameter name rather than position. For example, instead of calling Method(1, 2), you can write Method(value1: 1, value2: 2), making the code more readable and allowing you to skip optional parameters. Optional arguments are parameters with default values, positional parameters are the traditional positional approach, and named arguments specifically refer to the name-association feature.

Multiple choice technology programming languages
  1. By setting the object to Null

  2. By setting the object to Nothing

  3. With Close keyword

  4. None of the above

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

In VB.NET, objects are dereferenced and released from memory by setting them to Nothing. This is different from C# and other languages that use null. The Nothing keyword assigns the object reference to null, allowing the garbage collector to reclaim memory.