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 databases
  1. NULLIF

  2. LENGTH

  3. CONCAT

  4. INSTR

  5. TAN

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

CONCAT can return non-null when passed NULL arguments. In most SQL dialects, CONCAT with NULL arguments treats NULL as an empty string, producing a non-NULL result. For example, CONCAT(NULL, 'a') or CONCAT(NULL, NULL) typically returns a non-null string (empty or partial result). Other functions like LENGTH, NULLIF, INSTR, TAN generally return NULL when any argument is NULL.

Multiple choice technology databases
  1. a) Raise Application procedure

  2. b) Raise Application Error procedure

  3. c) Application Error procedure

  4. d) None of the Above

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

The RAISE_APPLICATION_ERROR procedure is a built-in Oracle utility used to issue user-defined error messages and error codes (between -20000 and -20999) from stored subprograms and database triggers.

Multiple choice technology databases
  1. a) The package itself cannot be called, parameterized, or nested.

  2. b) The format of a package is similar to that of a subprogram.

  3. c) The contents can be shared by many applications once written.

  4. d) None of the above.

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

All statements (a, b, and c) are true: packages cannot be parameterized or nested, their format resembles subprograms, and their contents can be shared. Therefore, 'None of the above' is the false statement.

Multiple choice technology databases
  1. a) VARCHAR2

  2. b) BOOLEAN

  3. c) OUT

  4. d) IN

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

To solve this question, the user needs to be familiar with the different types of arguments that can be passed between a procedure and the calling environment.

A. VARCHAR2 is a data type used to store character strings in Oracle.

B. BOOLEAN is a data type used to store logical values (TRUE or FALSE) in Oracle.

C. OUT is a parameter mode that is used to pass values from a procedure to the calling environment.

D. IN is a parameter mode that is used to pass values from the calling environment to a procedure.

Therefore, the correct answer is:

The Answer is: C

Multiple choice technology databases
  1. a) Local variables.

  2. b) Arguments.

  3. c) Boolean variables.

  4. d) Substitution variables.

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

When creating stored procedures and functions, the option that allows you to transfer values to and from the calling environment is:

B. Arguments.

Arguments, also known as parameters, are variables that are defined within a stored procedure or function and can be used to receive values from the calling environment. These values can be passed to the procedure or function when it is executed, and the procedure or function can also return values back to the calling environment using these arguments.

Option A, local variables, are variables defined within the scope of the procedure or function and are not used for transferring values to and from the calling environment.

Option C, boolean variables, are variables that can hold a true or false value and are not specifically designed for transferring values to and from the calling environment.

Option D, substitution variables, are variables used in SQL*Plus and Oracle SQL Developer tools and are not used for passing values to and from the calling environment in stored procedures or functions.

So, the correct answer is B. Arguments.

Multiple choice technology databases
  1. a) VARCHER2.

  2. b) BOOLEAN.

  3. c) OUT.

  4. d) IN.

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

To answer this question, the user needs to have knowledge of different types of arguments in programming.

a) VARCHER2: This is not a type of argument. It is a data type used to store character strings in Oracle database.

b) BOOLEAN: This is not a type of argument that passes a value from a calling environment.

c) OUT: This type of argument passes a value to the calling environment. It is used when a function or procedure needs to return more than one value.

d) IN: This type of argument passes a value from the calling environment to the function or procedure. It is used when a function or procedure needs to receive values from the calling environment.

Therefore, the correct answer is:

The Answer is: D. IN.

Multiple choice technology testing
  1. Browser("Ultimatix GetConnected").Page("Ultimatix GetConnected").WebEdit("employeeNumber").Set "000000"

  2. Browser("title:=Ultimatix - Get Connected !").Page("title:=Ultimatix - Get Connected !").WebEdit("name:=employeeNumber").Set "000000"

  3. Browser("title:=Ultimatix - Get Connected !"). Page("title:=Ultimatix - Get Connected !"). WebEdit("employeeNumber").Set "000000"

  4. Browser("Ultimatix GetConnected").Page("Ultimatix GetConnected"). WebEdit("name:=employeeNumber").Set "000000"

Reveal answer Fill a bubble to check yourself
C Correct answer
Multiple choice technology programming languages
  1. function_name() {command-list }

  2. function_name ( ) { }

  3. function name (command list ) {

  4. None

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

Shell functions are declared using the function_name() { command-list; } syntax. The function name is followed by empty parentheses, then a command list enclosed in braces. This is the standard POSIX-compliant function declaration format in bash and other Unix shells.

Multiple choice technology programming languages
  1. while,until

  2. until, while

  3. repeat, while

  4. None

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

while loops continue as long as the condition returns true (exit status 0). until loops continue until the condition becomes true, meaning they execute when the condition returns false (non-zero exit status). This is the inverse logic of while loops.

Multiple choice technology programming languages
  1. a) A function must return a value.

  2. b) A procedure must return a value.

  3. c) A function executes a PL/SQL statement.

  4. d) A function is invoked as part of an expression.

  5. e) A procedure must have a return data type specify in its declaration.

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

In PL/SQL, a function must return a value and is invoked as part of an expression. Procedures do not return values in this manner and do not have a return data type in their declaration.

Multiple choice technology programming languages
  1. a) An exception cannot propagate across remote procedure calls.

  2. b) An exception raised inside a declaration immediately propagates to the current block.

  3. c) The use of the RAISE; statement in an exception handler reprises the current exception

  4. d) An exception raised inside an exception handler immediately propagates to the enclosing block.

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

Exception propagation rules: (1) Exceptions cannot propagate across remote procedure calls (RPC boundary). (2) RAISE; in an exception handler re-raises the current exception. (3) An exception raised inside an exception handler immediately propagates to the enclosing block. Option B is false - exceptions in declarations propagate to the enclosing block, not the current one.

Multiple choice technology testing
  1. Browser("Ultimatix GetConnected").Page("Ultimatix GetConnected").WebEdit("employeeNumber").Set "000000"

  2. Browser("title:=Ultimatix - Get Connected !").Page("title:=Ultimatix - Get Connected !").WebEdit("name:=employeeNumber").Set "000000"

  3. Browser("title:=Ultimatix - Get Connected !"). Page("title:=Ultimatix - Get Connected !"). WebEdit("employeeNumber").Set "000000"

  4. Browser("Ultimatix GetConnected").Page("Ultimatix GetConnected"). WebEdit("name:=employeeNumber").Set "000000"

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

This statement uses descriptive programming for the Browser and Page objects using regular expressions (title:=...), and standard repository identification for the child WebEdit object, which is syntactically valid in QTP.

Multiple choice technology web technology
  1. True

  2. False

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

The finally block always executes when the try block exits, regardless of how it exits - whether through normal execution, an exception, or a return statement. The only exceptions are if the JVM exits (via System.exit()) or the thread dies. Even when return is the last statement in try, finally runs before the method actually returns.