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. Runtime Exception

  2. finally block will be executed

  3. finally block will not be executed

  4. Compilation error in else block

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

System.exit() terminates the JVM immediately, preventing the finally block from executing. Additionally, the while(true) loop in the if branch never exits, so the finally block would never be reached in that case either. Only if neither branch executes would finally run, but the structure guarantees one of them does.

Multiple choice technology programming languages
  1. Runtime Exception

  2. finally block will be executed

  3. finally block will not be executed

  4. Compilation error in else block

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

This is a duplicate of question 149704. System.exit() terminates the JVM immediately, preventing the finally block from executing. The while(true) loop also never exits. In both cases, the finally block is unreachable.

Multiple choice technology platforms and products
  1. Forward chaining

  2. Backward chaining

  3. Both of the above

  4. None of the above

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

Forward chaining automatically recalculates property values whenever any input property changes, using declarative rules. Backward chaining requires explicit triggering when the output value is needed. Forward chaining provides proactive, automatic updates.

Multiple choice technology platforms and products
  1. Clipboard

  2. Tracer

  3. Performance tool

  4. Rules Inspector

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

The Tracer tool in Pega is used for debugging and troubleshooting processes. It allows developers to trace execution flow and inspect parameter values, clipboard contents, and other runtime information. Clipboard is for storing data, Performance tool monitors system performance, and Rules Inspector shows rule details.

Multiple choice technology storage
  1. a) The use of a variable before it has been defined

  2. b) Unreachable (“dead”) code

  3. c) Whether the value stored in a variable is correct

  4. d) The re-definition of a variable before it has been used

  5. e) Array bound violations

Reveal answer Fill a bubble to check yourself
C Correct answer
Multiple choice technology testing
  1. 1 test for statement coverage, 3 for branch coverage

  2. 2 tests for statement coverage, 2 for branch coverage

  3. 2 tests for statement coverage. 3 for branch coverage

  4. 3 tests for statement coverage, 2 for branch coverage

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

Two test cases are sufficient for both statement and branch coverage. The first test (e.g., A=10, B=5, D=5) covers the true branch of the first IF and the true branch of the second IF. The second test (e.g., A=5, B=10, D=10) covers the false branches, achieving full coverage.

Multiple choice technology testing
  1. The use of a variable before it has been defined

  2. Unreachable (“dead”) code

  3. Whether the value stored in a variable is correct

  4. The re-definition of a variable before it has been used

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

Static analysis examines code without executing it, so it can find structural issues like undefined variables, unreachable code, or variable redefinitions. However, it cannot verify semantic correctness - whether the value stored in a variable matches the intended business logic. Static analysis tools don't understand your requirements, so they can't tell if 'x = 5' should have been 'x = 10' - only dynamic testing with known inputs and expected outputs can verify correctness.

Multiple choice technology programming languages
  1. 0

  2. 1

  3. 2

  4. undefined

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

When a user-declared constructor is defined, the compiler stops generating the default constructor. This struct has two user-declared constructors: a copy constructor 'A(A& a)' and a converting constructor 'A(double d)'. Because at least one constructor is explicitly declared, the compiler will NOT generate any additional constructors (no default constructor, no copy constructor since one exists, no move constructors). Therefore, the number of implicitly-defined constructors is 0.

Multiple choice technology programming languages
  1. True

  2. False

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

In C++, name lookup is sequential. At the point of x++ in bar(), x has not yet been declared in the namespace. Thus, name lookup fails, and bar() cannot access x without a forward declaration or declaring x first.

Multiple choice technology architecture
  1. (a) They are stored on the clipboard as temporary variables

  2. (b) They exist only within the context of an activity

  3. (c) They can be stored in the database

  4. (d) They are stored in a named page that is created automatically

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

Local Variables in programming exist only within the context of a specific activity, function, or block. They are created when that context is entered and destroyed when it exits. They are not stored on the clipboard, not automatically stored in databases, and not stored in automatically created pages. Their scope is limited to their defining context.

Multiple choice technology architecture
  1. (a) They are stored on the clipboard as temporary variables

  2. (b) They exist only within the context of an activity

  3. (c) They can be stored in the database

  4. (d) They are stored in a named page that is created automatically

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

Local variables in PRPC activities are scoped only to the activity's execution context. They are not stored on the clipboard, cannot be persisted to the database, and are not automatically stored in named pages - they exist temporarily during activity execution.

Multiple choice technology databases
  1. True

  2. False

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

Functions can have OUT parameters in many programming languages and database systems. In Oracle PL/SQL, functions explicitly support OUT parameters. However, this is context-dependent - SQL Server functions do not allow OUT parameters. The question assumes a context where this is valid.