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. 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 $? contains the status (return code) of the last external command executed, typically through system(), backticks, or piped opens. It is not for page length, EOL characters, or library error codes. The value is 0 for successful execution and non-zero for errors, following Unix conventions.

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 current value of errno (the error code from a system library routine) when a system call fails. It provides both numeric error code in numeric context and descriptive error string in string context. It is not for page length, EOL characters, or command return codes (which is $?).

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 of Above

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

The splice function can replace push when used with the current array size as the starting position. By setting the offset to scalar(@array) (the end of the array), length to 0 (nothing removed), and providing @sublist as the elements to insert, splice behaves exactly like push - appending elements to the array's end.

Multiple choice technology programming languages
  1. hash

  2. noexit

  3. nozero

  4. die

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

The die function in Perl terminates program execution with a nonzero exit status and outputs an error message to standard error. This makes it the appropriate choice for ensuring your program indicates failure through its exit code, even when errors occur during execution.

Multiple choice technology programming languages
  1. Asynchronous

  2. Synchronous

  3. Synchronous and Asynchronous

  4. None of above

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

In SAP BDC (Batch Data Communication), the Session Method is Synchronous. When a session is created and processed, it waits for the session to complete before proceeding. This is different from Call Transaction which can be Asynchronous. Session method ensures data integrity through synchronous processing.

Multiple choice technology programming languages
  1. Type N

  2. Type C

  3. Type F

  4. Type P

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

In SAP ABAP, the PARAMETERS statement can only use data types N (numeric text), C (character), and P (packed decimal). Type F (floating-point) is not allowed for PARAMETERS because it can cause precision issues and is not suitable for user input parameters. Floating-point types are better suited for internal calculations.

Multiple choice technology programming languages
  1. Buffers are always used

  2. Choice of buffer can be made to use

  3. Buffers are always bypassed

  4. None of above

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

In inner and outer joins, buffers are always bypassed because the database must access the actual table data to perform the join operation correctly across tables. Using buffered data could produce inconsistent results since buffers only contain individual table data.

Multiple choice technology programming languages
  1. No

  2. Case sensitivity is compiler-determined

  3. Yes

  4. Don't Know

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

C++ is a case-sensitive programming language, meaning that identifiers like Variable and variable are treated as completely different symbols.

Multiple choice technology programming languages
  1. True

  2. False

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

The finally block is guaranteed to execute after the try and catch blocks, regardless of whether an exception is thrown or successfully caught. This ensures critical resources are always cleaned up even during unhandled exceptions, which makes the statement true.

Multiple choice technology databases
  1. Numeric data

  2. Data type

  3. Char data

  4. None of the Above

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

The aggregate functions MIN and MAX can be applied across various data types that support comparison operations, including numeric, character, and date data types. Thus, they are not limited to just numeric data.

Multiple choice technology databases
  1. Numeric data

  2. Data type

  3. Char data

  4. None of the Above

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

MIN and MAX functions work on any data type that supports ordering comparisons, such as numbers, strings, and dates, making the option covering all data types correct.

Multiple choice technology programming languages
  1. True

  2. False

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

Handling an exception is designed to prevent abrupt program termination, allowing the application to recover and continue running or shut down gracefully. Because unhandled exceptions are what cause a program to terminate immediately, the statement that handling an exception allows termination is false.

Multiple choice technology programming languages
  1. Divide by zero error

  2. Accessing the elements of an array beyond its range

  3. Invalid input

  4. Opening an empty file

  5. Hard disk crash

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

Exceptions include: Divide by zero (ArithmeticException), array index out of bounds (ArrayIndexOutOfBoundsException), and invalid input (depending on type, could be NumberFormatException, IllegalArgumentException, etc.). Hard disk crash represents an Error (not Exception) but is still a throwable condition. Opening an empty file is not typically an exception - it's a valid file operation that just returns empty data.