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. Prefix the string 'private' to the variable name.

  2. initialize it with '_init_private'

  3. initialize it with double underscore '__'

  4. append the keyword 'pvt' before the variable.

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

Python uses name mangling with double underscore prefix (__) to indicate private variables. This makes the variable harder to access from outside the class, though it's still technically possible.

Multiple choice technology programming languages
  1. True

  2. False

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

Final methods in Java CANNOT be overridden by subclasses. The final keyword specifically prevents modification - it's the entire purpose. When a method is declared final, subclasses must use it as-is and cannot provide their own implementation. Therefore the answer 'False' to 'Can final method be overridden?' is correct.

Multiple choice technology web technology
  1. True

  2. False

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

Casting between datatypes can succeed but produce illegal values (e.g., casting a large double to int silently truncates), while Convert methods throw exceptions for invalid operations (e.g., Convert.ToInt32("abc") throws FormatException). Casting is unchecked; Convert validates the operation.

Multiple choice technology programming languages
  1. True

  2. False

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

In Java, sizeof is an operator (not available at the language level in Java - it exists in C/C++), but it is NOT a reserved keyword. Java has no sizeof keyword because memory size is platform-independent. Therefore the statement 'Is sizeof a keyword' is False, making the claimed answer correct.

Multiple choice technology programming languages
  1. Value type variables are stored on stack. Reference type variables are stored on heap.

  2. Value type holds the data directly, Reference type points to the location that holds the data.

  3. Value type cannot contain null value. Reference type can contain null value.

  4. A new type cannot be derived from value type. A new type can be derived from reference type.

  5. All of the above

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

Value types and reference types differ in multiple ways: storage location (stack vs heap), data handling (direct vs pointer), nullability (value types cannot be null), and inheritance (value types are sealed). All options A-D are correct differences, making option E the right answer.

Multiple choice technology databases
  1. "&"

  2. ACCEPT

  3. PROMPT

  4. "&&"

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

The && (double ampersand) substitution variable retains its value after first use, eliminating repeated prompts. The & variable prompts each time it's referenced. ACCEPT and PROMPT are commands for interactive input, not substitution variables. && is the correct choice for reuse without prompting.

Multiple choice technology programming languages
  1. CALL FUNCTION

  2. CALL SCREEN

  3. CALL TRANSACTION

  4. CALL PROGRAM

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

To understand this question, the user needs to know about CALL statements in programming. CALL statements are used to call other programs or functions within a program.

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

A. CALL FUNCTION: This is a valid statement in programming. It is used to call a specific function within a program.

B. CALL SCREEN: This is also a valid statement in programming. It is used to call a specific screen within a program.

C. CALL TRANSACTION: This is a valid statement in programming. It is used to call a specific transaction within a program.

D. CALL PROGRAM: This is NOT a valid statement in programming. The correct statement is CALL FUNCTION, which is used to call a specific function within a program.

Therefore, the answer is: D

Multiple choice technology mainframe
  1. This value is stored in the system variable RESULT.

  2. This value is stored in the system variable RC.

  3. This value can be alphanumeric.

  4. This value must be numeric.

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

In REXX, a subroutine returns a value using the RETURN clause, which is automatically saved in the special variable RESULT. This returned value is a character string and can be alphanumeric.