Computer Knowledge

Programming Fundamentals

2,381 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. 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.