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 mainframe
  1. *TIMD

  2. *TIMY

  3. *TIME-OUT

  4. *TIMN

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

Natural system variables start with an asterisk. Among the choices, *TIMD (time time-of-day), *TIME-OUT (inactive time limit), and *TIMN (time numeric) are valid system variables in Natural. *TIMY is not a valid system variable; *DATY is used for the year or date in other formats.

Multiple choice technology
  1. True

  2. False

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

OWB generates PL/SQL code for mappings and workflows, and this generated code can be modified by developers. While best practice is to let OWB regenerate code from the design, the system allows manual code customization for specialized requirements. The answer correctly states this is True.

Multiple choice technology programming languages
  1. The switch & case statement

  2. ?: (ternary operator)

  3. The #endif statement

  4. The nestedif statement

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

The switch and case statement provides a clean control structure to select and execute one of many blocks of code, acting as an alternative to long, chained if-else statements. Ternary operators and preprocessor directives do not serve this purpose.

Multiple choice technology programming languages
  1. True

  2. False

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

C++ fully supports functions as the fundamental building blocks for organizing code into reusable, modular units. Functions allow you to encapsulate specific tasks, pass parameters, and return values. This is a core feature of C++ inherited from C and essential for structured programming.

Multiple choice technology programming languages
  1. True

  2. False

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

C++ supports structures through the 'struct' keyword, which allows grouping related data items under a single name. Structures can contain different data types and are similar to classes, with the main difference being default access visibility (public for structs, private for classes). This feature is inherited from C and is fundamental to data organization.

Multiple choice technology programming languages
  1. const

  2. volatile

  3. mutable

  4. All the Above

  5. None of the Above

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

All three keywords qualify how variables are stored, qualified, or accessed in C++. The const keyword prevents modification, volatile prevents compiler optimizations for variables changed externally, and mutable allows members to be modified within const member functions.

Multiple choice technology programming languages
  1. call by value

  2. call by reference

  3. call by address

  4. All the Above

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

Passing pointers to functions allows the function to access and modify the original variables directly, mimicking call by reference behavior. While C++ introduces actual reference variables, passing pointers is traditionally called call by reference or call by address in C-like languages.

Multiple choice technology programming languages
  1. Inline functions

  2. virtual functions

  3. Both A and B

  4. None of the Above

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

Inline functions work by substituting the function body directly at the point of call, eliminating function call overhead. This is different from virtual functions, which use dynamic dispatch through vtables. The insertion of code at call point is the defining characteristic of inline functions.

Multiple choice technology programming languages
  1. stdlib.h

  2. iomanip.h

  3. console.h

  4. conio.h

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

The setprecision manipulator in C++ is used to set the precision for floating-point output operations. It requires the header file (or iomanip.h in older C++ style). The iostream header provides basic input/output functionality, while iomanip specifically provides I/O manipulators like setprecision, setw, setfill, etc.

Multiple choice technology programming languages
  1. static variables

  2. register variables

  3. global variables

  4. None of the Above

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

In C++, external variables (declared with extern keyword) are also called global variables because they have global scope and can be accessed across multiple source files. Static variables have file scope only, register variables are storage class specifiers for CPU register allocation, so they are different concepts from external variables.

Multiple choice technology programming languages
  1. It resembles the header Of the function definition

  2. It tells the compiler the Names of the parameters

  3. It must be declared before its corresponding functions can be utilized

  4. All the above are incorrect

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

Function prototypes must be declared before the corresponding functions can be used in the code. This allows the compiler to perform type checking on function calls. A prototype does resemble the function header (option A is partially correct but not complete), and it does tell the compiler parameter types but typically not names (option B is incorrect). Option C correctly states the essential purpose - declaration before usage.

Multiple choice technology programming languages
  1. call by value

  2. call by reference

  3. call by address

  4. All the Above

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

Using pointers to pass arguments to a function allows the function to access and modify the original variables through their memory addresses. This technique is called call by reference. Call by value creates a copy, and call by address is not standard terminology - call by reference and call by address mean essentially the same thing.