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 programming languages
  1. There can be any number of var-arg parameters in a method

  2. Only one var-arg parameter is allowed and it must be declared as last parameter in method definition.

  3. Only one var-arg parameter is allowed and it must be declared as first parameter in method definition.

  4. None of the above

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

Java allows only one var-arg (variable arity) parameter per method, and it must be the last parameter declared. This enables calls with 0 to N arguments for that parameter. Multiple var-args or placing var-args first would create ambiguity in method invocation.

Multiple choice technology programming languages
  1. Type N

  2. Type C

  3. Type F

  4. Type P

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

In SAP ABAP, the PARAMETERS statement does not support defining parameters of type F (floating-point number) directly on selection screens because floating-point values cannot be rendered and validated in standard input fields. Types C (character), N (numeric text), and P (packed number) are fully supported.

Multiple choice technology programming languages
  1. For efficient program writing, we need syntax which is not strict

  2. For efficient program writing, we need syntax which is strict

  3. For quick compiler design, syntax is strict

  4. Syntax strictness and compiler design are not related

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

Strict syntax makes compiler design easier and faster (quick compiler design). Strict syntax reduces parsing complexity and ambiguity, which is beneficial for compiler implementers even if it's less convenient for programmers.

Multiple choice technology programming languages
  1. True

  2. False

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

ABAP programs can have only one INITIALIZATION event, which executes before the selection screen is displayed. Coding a second INITIALIZATION event will trigger a syntax error because the parser cannot determine which one should execute first. This is different from events like START-OF-SELECTION which can be coded multiple times.

Multiple choice technology programming languages
  1. sy-subrc

  2. sy-fdpos

  3. error class

  4. system-exceptions

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

When using the CATCH...ENDCATCH statement (the obsolete ABAP error handling mechanism before TRY...CATCH), the runtime error return code is placed in the system field sy-subrc. This allows the program to check what error occurred.

Multiple choice technology programming languages
  1. Contains no rows

  2. Contains at least one row

  3. Has a header line

  4. Has an empty header line

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

The expression itab[] refers to the body of the internal table. Checking NOT itab[] IS INITIAL evaluates to true when the internal table contains at least one row, allowing the program to continue with the next line of code instead of exiting the current processing block.

Multiple choice technology programming languages
  1. AT START OF

  2. AT FIRST

  3. AT LAST

  4. AT NEW

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

ABAP control break processing includes AT FIRST (executed once before first loop), AT LAST (executed once after last loop), AT NEW (executed when control level changes), and AT END OF (executed when control level ends). AT START OF is not a valid ABAP control break statement - this is a distractor mixing valid keywords.

Multiple choice technology programming languages
  1. a&b

  2. a&c

  3. b&c

  4. b&d

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

In ABAP, CHANGING VALUE implements pass-by-value-and-result. The formal parameter gets its own memory space (a is true), the address is NOT passed (b is false - that's reference), and at the end, the formal parameter's value IS copied back to the actual parameter's space (c is true, d is false). Therefore a&c is correct.

Multiple choice technology programming languages
  1. True

  2. False

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

The 'this' keyword in Java is a reference variable that refers to the current object. It is automatically assigned by the JVM and cannot be explicitly set to null by the programmer - attempting 'this = null' is a compilation error. The statement is correct.

Multiple choice technology web technology
  1. are different how they handle failure

  2. both are same in every aspects

  3. is include() produced a Fatal Error while require results in a Warning

  4. none of above

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

The core difference lies in how they handle execution failures. A failed include() emits a warning and allows the script to continue running, whereas require() emits a fatal error and terminates execution. The distractors switch these roles or claim they are identical.

Multiple choice technology web technology
  1. method

  2. function

  3. statement

  4. operator

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

void is a unary operator in JavaScript that evaluates its expression and returns undefined. It is not a method, function, or statement - it's specifically an operator used when you want to execute a side effect without returning a value.