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. The loop is skipped

  2. The loop is repeated for all the values of the field

  3. Infinite loop

  4. The loop is executed once.

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

In Model 204, when K is negative in 'FOR K VALUES OF FIELDNAME', the statement loops through ALL occurrences of the field, not just a limited number. This is a special case where a negative value acts as a flag to process the entire set. Option B correctly describes this behavior. Options A and D are incorrect because the loop is neither skipped nor executed just once. Option C is incorrect because the loop terminates after processing all values.

Multiple choice technology programming languages
  1. CLEAR LIST IN listname

  2. CLEAR LIST listname

  3. CLEAR LIST ON listname

  4. CLEAR listname

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

The correct syntax for CLEAR LIST in Model 204 is 'CLEAR LIST listname' without any preposition like IN or ON. This command removes all entries from the specified list. Option B correctly shows the proper syntax. Options A and C are incorrect because they use unnecessary prepositions (IN, ON). Option D is incorrect because it omits the required LIST keyword.

Multiple choice technology programming languages
  1. native

  2. limited

  3. my

  4. regional

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

The 'my' operator in Perl creates private (lexically scoped) variables within a subroutine or block. These variables are only accessible within their declared scope and are destroyed when the scope ends. Options A, B, and D are not valid Perl variable declaration keywords.

Multiple choice technology programming languages
  1. next

  2. last

  3. redo

  4. leave

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

In Perl, the next operator jumps to the end of the current loop iteration and continues with the next iteration, but does not exit the loop entirely. The last operator exits the loop completely, while redo restarts the current iteration without advancing. leave is not a valid Perl loop operator.

Multiple choice technology programming languages
  1. Page length of a particular output file

  2. The input end-of-line character

  3. The return code returned by a command called by the system function.

  4. The error code generated by a system library routine.

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

In Perl, the special variable $? stores the return code (exit status) from the last system function call, child process, or backtick command. A value of 0 typically indicates success, while non-zero values signal errors or specific exit statuses.

Multiple choice technology programming languages
  1. Page length of a particular output file

  2. The input end-of-line character

  3. The return code returned by a command called by the system function.

  4. The error code generated by a system library routine.

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

In Perl, the special variable $! contains the error number or error string from the last system call or library function that failed. When used in a numeric context, it returns the error code; in string context, it returns the corresponding error message.

Multiple choice technology programming languages
  1. splice (@array,0.0.@sublist);

  2. splice (@array, scalar(@array),0, @sublist);

  3. splice (@array, 1, 0, @sublist);

  4. None

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

push(@array, @sublist) appends elements to the end of an array. The equivalent splice call uses scalar(@array) as the offset (position after the last element), removes 0 elements, and inserts the sublist, achieving the same append operation.

Multiple choice technology web technology
  1. function:myFunction()

  2. function myFunction()

  3. function=myFunction()

  4. function=myFunction(){ }

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

JavaScript functions are declared using the 'function' keyword followed by the function name and parentheses, with the function body enclosed in curly braces. Option B shows the correct syntax. Options A, C, and D use incorrect separators (: or =) instead of a space, which are not valid JavaScript function declaration syntax.

Multiple choice technology mainframe
  1. True

  2. False

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

COND=ONLY in a JCL step means that step executes ONLY if any previous step terminated abnormally (with a non-zero return code). This is a conditional execution mechanism that runs cleanup or recovery steps only when failures occur in the job stream.