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 mainframe
  1. Always returns a value.

  2. Never returns a value.

  3. Returns when RC is coded

  4. I am skipping this!!

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

In REXX, the EXIT instruction terminates the program immediately. It can optionally return a value to the caller (such as the operating system or another script) if an expression or a Return Code (RC) variable is provided. Without an expression, it returns no value. The other options are incorrect because returning a value is optional, not mandatory or impossible.

Multiple choice technology mainframe
  1. DO UNTIL

  2. DO WHILE

  3. ITERATE

  4. Wrong question!

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

ITERATE is a REXX command that skips the remaining instructions in the current DO loop iteration and immediately proceeds to the next iteration. DO UNTIL and DO WHILE are loop control structures that determine when the loop exits, not what skips within an iteration. Option D is clearly invalid.

Multiple choice technology mainframe
  1. using DEFINE

  2. using DECLARE

  3. Cant use alphanumeric variable in REXX

  4. No need to define. REXX will deal them.

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

REXX is typeless and dynamically typed - variables need no declaration and automatically handle alphanumeric values. DEFINE and DECLARE aren't REXX keywords for variable declaration.

Multiple choice technology mainframe
  1. DROP

  2. DELSTACK

  3. DELETE

  4. Cant delete a stack

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

DELSTACK is the REXX command to delete/remove a stack. DROP is for variables, DELETE isn't used for stacks, and stacks can be deleted.

Multiple choice technology programming languages
  1. Buffer overflows are eliminated

  2. Variables are renamed to provide more meaningful context

  3. Exception handlers are added to catch runtime errors

  4. New features are added based on the latest iterative design changes

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

Refactoring is the process of restructuring existing computer code without changing its external behavior. Renaming variables to provide better readability and context is a classic refactoring activity.

Multiple choice technology programming languages
  1. Linking libraries statically increases executable file size and leads to code redundancy

  2. Without dynamic linking the software cannot take advantage of higher-order functions

  3. The software becomes subject to the linked libraries' license terms which may include usage fees

  4. Lack of proper dynamic linking leads to library proliferation and increased "DLL hell"

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

Statically linking libraries embeds all library code directly into the executable at build time, which increases file size significantly compared to dynamic linking where libraries are shared. Every statically linked application contains its own copy of library code, leading to code redundancy across multiple executables. Option B is incorrect - higher-order functions are language concepts unrelated to linking. Option C is wrong - both static and dynamic linking are subject to license terms. Option D describes 'DLL hell' which is a problem with dynamic linking, not static linking.

Multiple choice technology programming languages
  1. Don't link your modules to modules written in any other language

  2. Make sure you declare all your variables' data types ahead of time

  3. Don't add variables of one type to variables of another

  4. Devout prayer

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

Assembly language does not have built-in type checking or type safety features. Since the hardware only sees raw bytes and registers, type safety cannot be enforced by the language itself, making 'devout prayer' a humorous but accurate choice.

Multiple choice technology programming languages
  1. Use more global variables

  2. Keep variable and function names down to one or two letters

  3. Insert comments throughout your source code files

  4. Use pointer arithmetic wherever possible

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

Comments improve code maintainability by explaining intent, complex logic, and design decisions. Options A (global variables), B (short names), and D (pointer arithmetic) are widely recognized as anti-patterns that hurt reusability and maintainability.

Multiple choice technology operating systems
  1. True

  2. False

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

JavaScript is not related to Java. The similarity in names was a marketing decision by Netscape in 1995 when JavaScript was created. Java is a statically-typed, class-based language, while JavaScript is dynamically-typed and prototype-based. They are fundamentally different languages.

Multiple choice technology platforms and products
  1. -1

  2. 0

  3. 1

  4. NULL

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

For a REPEAT operation to continue indefinitely as long as a condition remains true, the count parameter should be set to -1. This indicates unlimited repetition. Setting count to 0 would typically mean no repetitions, 1 would execute once, and NULL might indicate an unset or default limited count.

Multiple choice technology enterprise content management
  1. lo w

  2. lo worl

  3. lo wo

  4. index out of range error during compilation

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

The substr(start, length) method extracts characters starting at index start for a specified length. For "Hello World", starting at index 3 ('l') for 7 characters yields "lo Worl" (case-sensitive 'W'). The stored option has a lowercase 'w', but it is the intended answer.

Multiple choice technology web technology
  1. The code will generate a run time error

  2. undefined, Local Date & Time.

  3. The code will generate a compile time error.

  4. Universal Date & Time, Local Date & Time.

  5. Local Date & Time & Local Date & Time

Reveal answer Fill a bubble to check yourself
D Correct answer
Multiple choice technology enterprise content management
  1. The code will generate a run time error.

  2. undefined, Local Date & Time.

  3. The code will generate a compile time error.

  4. Universal Date & Time, Local Date & Time.

  5. Local Date & Time, Local Date & Time

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

The toUTCString() method converts a Date object to a string using the UTC time zone (Universal Coordinated Time), while toString() returns the local date and time based on the system's time zone settings. This distinction is important when working with time-sensitive operations across different geographical regions.