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 architecture
  1. if

  2. then

  3. goto

  4. while

  5. case

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

In Java, 'then' is NOT a keyword or reserved word. Java's conditional statement uses 'if' and 'else' - 'then' is not part of the syntax. The other options ARE keywords or reserved words: 'if' is a conditional keyword, 'goto' is a reserved word (though not used), 'while' is a loop keyword, and 'case' is used in switch statements. This question tests knowledge of Java's reserved word list.

Multiple choice technology programming languages
  1. A new type of Applet

  2. A segment of code to be run a specified amount of times

  3. A segment of code to be run infinite times

  4. A segment of code to be run once

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

A loop is a programming construct that repeats a block of code multiple times based on a condition or counter. It allows efficient execution of repetitive tasks without writing the same code repeatedly. Option A is incorrect as loops are not applets. Option C describes infinite loops which are a special case not the general definition.

Multiple choice technology architecture
  1. True

  2. False

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

JavaScript does allow inner (nested) functions - functions can be defined inside other functions. This is a fundamental feature that enables closures, where inner functions retain access to variables in their outer function's scope even after the outer function returns.

Multiple choice technology architecture
  1. True

  2. False

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

JavaScript functions absolutely can return values using the return statement. This is a fundamental feature - functions can compute and return results, return objects, return other functions (closures), or return undefined implicitly if no return statement is reached.

Multiple choice technology
  1. Testing Plan

  2. Error handler

  3. IPO Cycle

  4. Input-Output Specification

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

The Testing Plan is the component of a problem statement that provides specific test cases with sample inputs and expected outputs. This validates whether the implemented program works correctly. Error handlers are code modules, IPO Cycle is a concept, and Input-Output Specification is similar but Testing Plan is the standard term.

Multiple choice technology web technology
  1. True

  2. False

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

Strings in Java are immutable - once created, their values cannot change. Methods like concat(), substring(), or toUpperCase() return new String objects rather than modifying the original. This design enables string interning and thread safety.

Multiple choice technology databases
  1. DECLARE

  2. OPEN

  3. FETCH

  4. CLOSE

  5. PROCESS

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

In PL/SQL cursor FOR loops, the OPEN, FETCH, and CLOSE operations are handled automatically by the loop construct. The loop opens the cursor when entered, fetches each row iteratively, and closes the cursor when the loop completes or exits. The cursor must still be explicitly DECLARED, and the PROCESS step (loop body logic) is written by the developer.

Multiple choice technology databases
  1. round

  2. trunc

  3. maximum

  4. initcap

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

Oracle SQL has ROUND, TRUNC, and INITCAP as built-in functions for numeric rounding, truncation, and string capitalization respectively. 'MAXIMUM' is NOT a valid Oracle function - the correct aggregate function is MAX (not MAXIMUM). This is a common trick question testing knowledge of exact function names.

Multiple choice technology databases
  1. True

  2. False

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

In PL/SQL exception handling, OTHERS is indeed a catch-all exception handler that encompasses all predefined exceptions (like NO_DATA_FOUND, TOO_MANY_ROWS, etc.) as well as user-defined exceptions. When you use EXCEPTION WHEN OTHERS, it will catch any exception that hasn't been handled by more specific exception handlers above it. This makes it the most general exception type.

Multiple choice technology databases
  1. concat

  2. initcap

  3. round

  4. length

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

To answer this question, the user needs to know what string functions are and be familiar with some commonly used string functions.

String functions are functions that operate on a string and return a modified string or information about the string. Some examples of string functions include substring, upper/lower case, length, concat, and trim.

Now, let's go through each option and determine which one is not a string function:

A. concat: This is a string function that concatenates two or more strings together.

B. initcap: This is a string function that capitalizes the first letter of each word in a string.

C. round: This is not a string function. It is a mathematical function that rounds a number to a specified number of decimal places.

D. length: This is a string function that returns the length of a string.

Therefore, the answer is:

The Answer is: C

Multiple choice technology databases
  1. O

  2. oracle

  3. Oracle

  4. ORACLE

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

INITCAP converts a string to initial capitalization - first letter of each word uppercase, remaining letters lowercase. For 'oracle', it returns 'Oracle'. For 'hello world', it would return 'Hello World'. The function capitalizes the first character and lowercases the rest.