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 mainframe
  1. RESET

  2. SET

  3. MOVE

  4. ASSIGN

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

The RESET statement in Natural programming initializes variables to their default values or resets them to null. This is different from SET (assigns values), MOVE (transfers values), or ASSIGN (calculates and assigns). RESET is specifically for initialization and clearing variable states.

Multiple choice technology programming languages
  1. <listener-class>

  2. <listener-type>

  3. <listener-name>

  4. <description>

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

When declaring a listener in web.xml, only is required - it specifies the fully qualified class name of the listener implementation. , , and are not valid or required sub-elements of . The listener class must implement the appropriate listener interface (ServletContextListener, HttpSessionListener, etc.).

Multiple choice technology web technology
  1. <%! %>

  2. <%= %>

  3. <% %>

  4. None of the above

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

In JavaServer Pages (JSP), the &lt;%! ... %&gt; syntax is a JSP declaration, which is used to declare variables or methods that are compiled into the generated servlet class. &lt;%= ... %&gt; is an expression, and &lt;% ... %&gt; is a scriptlet.

Multiple choice technology programming languages
  1. Variables read with the SET statement will not be affected by it

  2. The RETAIN statement is used when a variable needs to be

  3. Variables will be initialized to the desired value in each iteration

  4. Variables are created during execution

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

In SAS, the RETAIN statement prevents variables from being reset to missing at the start of each DATA step iteration. However, it does NOT affect variables read with SET statement - those come from the input dataset and are not subject to RETAIN. The other options are incorrect - RETAIN initializes once (not each iteration), doesn't create variables during execution, and the statement is incomplete.

Multiple choice technology programming languages
  1. It will be initialised to 1 in the begining

  2. It will have the observation number that caused the error

  3. It will not be dropped while writing into the dataset

  4. It can be used in expressions

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

The ERROR automatic variable in SAS can be used in IF statements and other expressions within the DATA step. It's NOT initialized to 1 at the beginning (it's 0), doesn't hold the observation number, and CAN be dropped from output datasets depending on logic. Its main use is in conditional expressions.

Multiple choice technology programming languages
  1. 1 can only be called with predecleration of complex_num

  2. 1 and 2 are same

  3. 2 can only be called with predecleration of complex_num

  4. 1 is reference to a subroutine

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

This refers to Perl subroutine predeclaration. In Perl, calling a subroutine before it's declared requires either predeclaration (forward declaration with 'sub name;') or using parentheses. Option 1 (likely '&sub or sub()) requires no predeclaration. Option 2 (likely just 'sub') requires predeclaration to avoid ambiguity with barewords. Thus option 2 specifically needs predeclaration of complex_num.

Multiple choice technology testing
  1. Dim statement

  2. Option Explicit statement

  3. Con Statement

  4. Const Statement

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

In VBScript (used in QTP/UFT and classic ASP), constants are declared using the Const statement, not Dim (which is for variables), Option Explicit (which forces variable declaration), or Con (which is not a valid statement). The Const statement creates a named value that cannot be changed during script execution, which is essential for maintaining code readability and preventing accidental modification of fixed values.

Multiple choice technology testing
  1. Byval

  2. Byref

  3. ByArg

  4. ByRes

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

In VBScript and QTP procedures, arguments are passed by reference (ByRef) by default. This means the procedure receives a reference to the original variable, so any changes made to the parameter within the procedure affect the original variable. ByVal must be explicitly specified if you want to pass a copy instead.

Multiple choice technology testing
  1. For next,Do loop, Switch Case

  2. For next, Do loop, While end

  3. If then, While end, Do loop

  4. For next, Switch case, If then

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

QTP uses VBScript, which provides For...Next, Do...Loop, and While...Wend (or Do While...Loop) as looping constructs. Option B correctly identifies these three. Option A incorrectly includes 'Switch Case' which is a conditional statement, not a loop. Option C mixes 'If then' which is conditional, not iterative.

Multiple choice technology platforms and products
  1. During flow execution as process conrtol advances from one task to another

  2. At the end of activity step,after invoking the method, but before any transition step

  3. Upon database commit when any object is saved to database

  4. All of the above

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

Declare rules execute at multiple points in PEGA processing. Some run during flow execution as control moves between tasks, others at activity step boundaries after method invocation but before transitions, and Declare Trigger rules specifically run when objects are committed to the database. The declare keyword provides automatic rule execution across these contexts.

Multiple choice technology programming languages
  1. No observations.No variables

  2. variable x is created with 3 observations with values 1,2 and 3

  3. Array should be given a name during initialization.Syntax Error

  4. The variables x1 , x2 and x3 are created with the values 1, 2 and 3

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

In SAS, defining an array x{3} with initial values (1,2,3) implicitly creates three variables named x1, x2, and x3 in the program data vector, assigning them the values 1, 2, and 3 respectively during execution of the DATA step.