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
  1. None; the statement is skipped.

  2. The THEN part of the statement is executed.

  3. The ELSE part of the statement is executed.

  4. Both the THEN and the ELSE parts of the statement are executed.

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

In an IF-THEN-ELSE structure, when the condition evaluates to true, only the THEN clause is executed. The ELSE clause is skipped entirely.

Multiple choice
  1. logic

  2. syntax

  3. pseudocode

  4. debugging

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

A logic error occurs when the algorithm or reasoning is wrong, even if the code is syntactically correct. Using addition instead of multiplication for area is a conceptual mistake in the problem-solving approach, not a syntax violation.

Multiple choice
  1. string, numeric

  2. numeric, string

  3. character, string

  4. indexed, string

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

Student names consist of text characters and must be stored in string arrays to preserve the text format. Prices represent numerical values and are stored in numeric arrays for arithmetic operations. This distinction is fundamental in programming - strings for text, numbers for calculations.

Multiple choice
  1. a DO WHILE...LOOP

  2. a FOR...NEXT loop

  3. two nested FOR...NEXT loops

  4. a DO UNTIL...LOOP statement

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

A two-dimensional array has rows and columns, requiring two separate loops to access all elements systematically. The outer loop iterates through rows, while the inner loop iterates through columns. This nested structure ensures every element in the 2D grid is processed exactly once.

Multiple choice
  1. concurrency

  2. conception

  3. configure

  4. concatenation

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

Concatenation is the operation of joining two or more strings end-to-end to create a single combined string. This is a fundamental string operation in programming, used extensively in text processing, formatting output, and building file paths. The term comes from Latin meaning 'to link together'.

Multiple choice
  1. Syntactic error debugging in a program is the process of identifying and correcting errors.

  2. Run-time or logical error debugging in a program is the process of identifying and correcting errors.

  3. Debugging through the Internet is the process of downloading a large file.

  4. Debugging is the process of defragmenting a hard disk.

  5. None of these

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

Option (2) is correct.

Multiple choice
  1. varray

  2. nested table

  3. record

  4. index-by tables

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

A PL/SQL record is a group of related data items. For example, the data about a student like roll no., name, date of birth are logically related to each other but have different types. A record containing a field for each item lets the user treat the data as a logical unit. Thus, making it easier to organise and represent. The syntax for creating a record is

type type_name is record (fielddeclaration1,fielddeclaration2...); 

Multiple choice
  1. Procedure can be called from SQL prompt, while function cannot be called from SQL prompt.

  2. Function can return a value, while procedure cannot return any value.

  3. Functions can have arguments, while procedure cannot have arguments.

  4. Function can call procedures while procedure cannot call functions.

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

The difference between a function and procedure is that a function can return a value to its calling function while a procedure cannot return a value. Function returns a value using the 'return' keyword. A function cannot return more than one value.

Multiple choice
  1. Declare

  2. Begin

  3. Return

  4. Exception

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

The declaration section of a PL/SQL program is used to contain all variable declarations. While using a function, the declare keyword is replaced by 'is' keyword. All the variables are declared inside the 'is' keyword. For example, CREATE OR REPLACE FUNCTION myfunc  RETURN VARCHAR(20); IS sname VARCHAR(20); BEGIN SELECT studname INTO sname FROM students WHERE rollno = 1; RETURN sname; END;/ 

Multiple choice
  1. The mode of a parameter can be both IN and OUT.

  2. A cursor parameter can be assigned a default value.

  3. The scope of the cursor parameter is local to the cursor.

  4. We can only specify the datatype of the parameter, not its length.

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

Parameterized cursors are static cursors that can accept passed-in parameter values when they are opened. The mode of parameter passed to a cursor can only be IN. The syntax for opening a parameterized cursor is open cursor_name(value)

Example: open mycursor(1000); where 1000 is the parameter value