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
-
*TIMD
-
*TIMY
-
*TIME-OUT
-
*TIMN
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.
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.
-
The switch & case statement
-
?: (ternary operator)
-
The #endif statement
-
The nestedif statement
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.
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.
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.
-
const
-
volatile
-
mutable
-
All the Above
-
None of the Above
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.
-
call by value
-
call by reference
-
call by address
-
All the Above
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.
-
Inline functions
-
virtual functions
-
Both A and B
-
None of the Above
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.
-
Syntax Error
-
Linker Error
-
Runtme Error
-
No Error, It will be run successfully
-
stdlib.h
-
iomanip.h
-
console.h
-
conio.h
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.
-
static variables
-
register variables
-
global variables
-
None of the Above
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.
-
Complies Successfully
-
Error Due to Duplicate Variables.
-
RunTime Error
-
Executes Successfully
-
It resembles the header Of the function definition
-
It tells the compiler the Names of the parameters
-
It must be declared before its corresponding functions can be utilized
-
All the above are incorrect
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.
-
call by value
-
call by reference
-
call by address
-
All the Above
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.
-
Syntax Error
-
Linker Error
-
Runtme Error
-
No Error, It will be run successfully