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. 1, 3 and 4

  2. 2, 3 and 4

  3. 2, 3 and 6

  4. 1, 3 and 5

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

Calling an external PL/I procedure requires proper declaration and invocation syntax. You must declare the entry with RETURNS keyword if it returns a value, declare the parameter and result variables, and call it with the parameter in parentheses. The correct combination is ENTRY declaration with RETURNS, variable declarations, and function call syntax with parameter.

Multiple choice technology programming languages
  1. True

  2. False

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

The exit() function is part of the C Standard Library, specifically in the cstdlib header (stdlib.h in C). It's used to terminate program execution and return a status code to the operating system. This is a standard function used throughout C and C++ programs for controlled program termination.

Multiple choice technology
  1. Simple, String

  2. Consolidated, Boolean

  3. Numeric, String

  4. String, Consolidated

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

Turbo Integrator (TI) processes support two variable types: Numeric (numbers) and String (text). Option C correctly identifies these two types, which are used for data manipulation and processing in TI scripts.

Multiple choice technology databases
  1. A monitor program which dispatch the events to the callback of the one of the member

  2. Monitor object with it's own callback function

  3. A monitor program which dispatch the events to the callback of the member of

  4. None

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

A monitor program should be written as a Monitor object with its own callback function. This allows the monitor to independently track queue status and take action when thresholds are exceeded. The other options describe dispatching mechanisms, not the monitor structure itself.

Multiple choice technology programming languages
  1. A

  2. B

  3. the code will fail

  4. None of the above

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

Calling B->new() inherits new from package A. In A::new, the single-argument bless {} blesses the object into the current package (A). Thus, $obj is an instance of A, and $obj->foo() calls A::foo which returns 'A'.

Multiple choice technology programming languages
  1. undef

  2. 0

  3. 1

  4. 2

  5. code will fail

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

When Perl evaluates exists $var->{key1}->{key2}, it autovivifies (auto-creates) the intermediate hash structure even though the key2 doesn't exist. This means $var->{key1} is created as an empty hash. The exists check returns false (key2 doesn't exist), so the assignment inside the if block doesn't execute. However, the autovivication already happened, leaving $var with one key (key1). keys(%{$var}) returns 1.

Multiple choice technology programming languages
  1. abcd

  2. acbd

  3. cadb

  4. code will fail

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

BEGIN blocks execute at compile time in declaration order, while END blocks execute at runtime in reverse declaration order (LIFO - last in, first out). The two BEGIN blocks print 'a' then 'c'. The two END blocks are declared in order (prints 'b' then 'd'), but execute in reverse order, so 'd' prints before 'b'. Final output: 'ac' from BEGIN blocks, then 'db' from END blocks, yielding 'cadb'.

Multiple choice technology mainframe
  1. (A) StartIF

  2. (B) Then

  3. (C) Goto

  4. (D) Else.

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

JCL does not support direct branching or control transfer keywords like GOTO. Conditional execution in JCL is handled strictly through the IF-THEN-ELSE-ENDIF construct or the COND parameter. The other options represent valid parts of JCL's conditional processing syntax.

Multiple choice technology databases
  1. Header

  2. Declarative

  3. Executable

  4. Exception

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

In PL/SQL, the RAISE statement can appear in both the Executable section (to explicitly raise exceptions during normal processing) and the Exception section (to re-raise exceptions or propagate user-defined exceptions). The RAISE statement is not used in the Header or Declarative sections. This is an MC-2 question expecting multiple correct answers.

Multiple choice technology mainframe
  1. (A) JSCAN

  2. (B) TYPERUN=SCAN on Job card

  3. (C) TYPERUN=JEM on Job card

  4. (D) (a) or (b)

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

JCL syntax can be validated either through the JSCAN utility (option A) or by specifying TYPERUN=SCAN on the JOB statement (option B). Both methods check JCL syntax without executing the job. Option C's TYPERUN=JEM is not a valid syntax-checking parameter, making option D correct as it includes both valid methods.

Multiple choice technology mainframe
  1. (A) Control Starts after the line where, FULLSTOP is present

  2. (B) Control Starts after the line where, First END-IF is present

  3. (C) Control starts after the line where, its respective END-IF is present

  4. (D) None of the above.

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

In COBOL, NEXT SENTENCE transfers control to the first statement after the period (FULLSTOP) that terminates the current sentence. In this nested IF structure, the period after 'End-If' (the one closing the outer IF) is the sentence terminator. When A=B is true, NEXT SENTENCE jumps to 'Move A to B', skipping everything between, including the entire ELSE block and the inner END-IF.