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. Foo d = c;

  2. Foo *d = c;

  3. Foo d; d=c;

  4. --

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

In Java, object variables are references by default, so Foo d = c; makes d reference the same object as c. In C++, the equivalent behavior requires using a pointer: Foo *d = &c; (note the address-of operator). However, in the context of this question's options, Foo *d = c; is the closest C++ pointer declaration equivalent, as C++ pointers are used to achieve reference-like behavior. Option A would be value semantics (copy), not reference semantics.

Multiple choice technology web technology
  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 specifically designed to trace and debug requestor sessions, including showing the values of parameters at each step. Clipboard shows the current page structure but doesn't provide runtime tracing capability. Performance tool is for load testing, and Rules Inspector is for viewing rule definitions.

Multiple choice technology web technology
  1. True

  2. False

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

Forward chaining in Pega REQUIRES all input property values to be available before computation can proceed - it does not allow advancement with missing inputs. The statement describes backward chaining behavior, which can work with incomplete information. Note the typo 'Farward' in the question.

Multiple choice technology web technology
  1. Property reference

  2. Literal

  3. Function

  4. Boolean expression

  5. Activity call

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

Models can contain property references (page.property), literals (constant values), functions (built-in functions), and boolean expressions (conditions). Activity calls are not allowed in models - models define data transformation, not execution flow.

Multiple choice technology databases
  1. CREATE OR REPLACE PROCEDURE <<Procedure name>> as

  2. CREATE OR REPLACE PROCEDURE <<Procedure name>>(Parameter list) as

  3. CREATE OR REPLACE PROCEDURE <<Procedure name>> is

  4. All of the above

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

Oracle PL/SQL procedure creation requires either AS or IS keyword after the procedure name. Parameter lists are optional. Both CREATE OR REPLACE PROCEDURE name AS and CREATE OR REPLACE PROCEDURE name IS are valid syntax. Adding a parameter list before AS/IS is also valid when parameters are needed.

Multiple choice technology security
  1. Trace, warn, error and fatal

  2. Trace, debug, info, warn, error and fatal

  3. Debug, info, error, fatal

  4. Debug, Warn, Error

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

The API provides four logging levels: Trace, warn, error, and fatal. Option B incorrectly includes debug and info which are not in this API. Options C and D are missing levels from the actual set.

Multiple choice technology security
  1. Trace, warn, error and fatal

  2. Trace, debug, info, warn, error and fatal

  3. Debug, info, error, fatal

  4. Debug, Warn, Error

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

The security API provides four logging levels: trace (most detailed), warn (warnings), error (errors), and fatal (critical failures). Option B lists six levels commonly found in general logging frameworks, but this specific security API implements a simpler four-level model.

Multiple choice technology programming languages
  1. True

  2. False

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

In Perl, code is NOT placed in a package called 'main' by default. The 'main' package exists as a special package for main program scope, but package declarations are explicit. Without a package declaration, code compiles in the current package (which may be 'main' initially but isn't automatically enforced as a container). Perl's default behavior differs from some other languages.

Multiple choice technology mainframe
  1. True

  2. False

  3. can't say

  4. none

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

COBOL does NOT require statements to start on a fresh line. Multiple statements can be written on the same line, separated by appropriate delimiters or scope terminators. This flexibility is different from some modern languages where line breaks are syntactically significant.

Multiple choice technology mainframe
  1. REPEAT 6 TIMES <n> instruction <n> END-REPEAT

  2. MOVE 1 TO COUNTER <n> PERFORM UNTIL COUNTER = 6 <n> COMPUTE COUNTER = COUNTER + 1 <n> instruction <n> END-PERFORM

  3. PERFORM 6 TIMES <n> instruction <n> END-PERFORM

  4. REPEAT VARYING COUNTER FROM 1 BY 1 UNTIL COUNTER = 6 <n> instruction <n> END-PERFORM

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

The correct COBOL syntax for repeating an instruction a fixed number of times is 'PERFORM n TIMES' followed by the instruction and 'END-PERFORM'. Option A uses REPEAT which is not standard COBOL. Option B incorrectly computes counter outside the loop. Option D incorrectly uses REPEAT with VARYING syntax.