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
  1. Macro

  2. Iteration

  3. Sub function

  4. Recursion

  5. Nested Function

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

The most common application of recursion is in mathematics and computer science, in which it refers to a method of defining functions in which the function being defined is applied within its own definition. Specifically this defines an infinite number of instances (function values), using a finite expression that for some instances may refer to other instances, but in such a way that no loop or infinite chain of references can occur.

Multiple choice
  1. True

  2. False

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

Cursors in PL/SQL can accept parameters, making them more flexible and reusable. Parameterized cursors allow you to pass values at runtime, enabling the same cursor definition to be used with different data sets based on the parameters provided.

Multiple choice
  1. TRUE

  2. FALSE

  3. Undefined

  4. NULL

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

The correct answer is D because in SQL, NULL is not a value but a marker for unknown/missing data. Any comparison operation involving NULL returns NULL (unknown), not TRUE or FALSE. Therefore, comparing two NULL values returns NULL, not TRUE, FALSE, or undefined. This is fundamental three-valued logic in SQL.

Multiple choice
  1. Clicking Step Over to step over the execution of the subprogram

  2. Opening the Stack panel, selecting the previous stack frame, and clicking Go

  3. Clicking Step Out to resume stepping through code after the subprogram is called

  4. Clicking Stop, setting a breakpoint immediately after the subprogram code is called, and running the form in debug mode again

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

Clicking Step Over to step over the execution of the subprogram

Multiple choice
  1. Multiple variables assigned the same value

  2. Multiple symbolic names and one data location

  3. Multiple variables assigned the same identifier

  4. Multiple variables assigned the same constant

  5. Multiple variables pointed by the same pointer

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

Aliasing describes a situation in which a data location in memory can be accessed through different symbolic names in the program.

Multiple choice
  1. %rowtype, %toomanyrows, %found

  2. %found, %notfound, %rowcount

  3. %rowtype, %rowcount, %notfound

  4. None of the above

  5. All of the above

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

Oracle PL/SQL implicit cursors (used in implicit SELECT statements and DML operations) have three key attributes: %FOUND (returns TRUE if a row was affected), %NOTFOUND (returns TRUE if no row was affected), and %ROWCOUNT (returns number of rows affected). %ROWTYPE is used for declaring record variables based on table structures, not as a cursor attribute. Option B correctly lists the three implicit cursor attributes.

Multiple choice
  1. AVG

  2. COUNT

  3. SUM

  4. STDDEV

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

COUNT is the only aggregate function listed that works with all data types (numeric, character, date). AVG, SUM, and STDDEV are mathematical functions that only work with numeric data. COUNT(*) counts rows, while COUNT(expression) counts non-null values regardless of data type.

Multiple choice
  1. Pragma Init Exception

  2. Pragma Exception

  3. ORA_EXCEPTION

  4. ORA_USER_EXCEPTION

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

PRAGMA EXCEPTION_INIT is a compiler directive that associates a user-defined error message with a specific Oracle error number. The other options are not valid PL/SQL constructs - ORA_EXCEPTION and ORA_USER_EXCEPTION don't exist, and 'Pragma Exception' is incomplete syntax.

Multiple choice
  1. Array

  2. Function

  3. Double

  4. Reference

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

This option is correct as double is not a derived data type rather it is a fundamental data type used for double precision floating point numbers, it is used for handling floating point numbers but it is treated a distinct data type because it occupies twice as much memory as type float and stores floating point numbers with much larger range and precision, hence it is NOT a derived data type.

Multiple choice
  1. TONUMBER

  2. TO_NUMBER

  3. TOCHAR

  4. TO_CHAR

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

This answer is correct. In Oracle, TO_CHAR is the function used to convert from number to a string. If any string is given to TO_CHAR, the result will still remain in string.

Multiple choice
  1. Total time of execution will be 10 milli seconds.

  2. The total time of execution will be 10 seconds.

  3. Total time of execution will be 40 seconds.

  4. None of the above

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

This option is correct because the execution time of one loop is 10 seconds and since the loop runs 4 times, hence the total time of program execution will be 40 seconds.

Multiple choice
  1. sequence structure

  2. selection structure

  3. iteration structure

  4. none of these

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

'Switch-Case' statement comes under the selection structure as it allows the user to select appropriate case statement depending upon the choice of the user.