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
-
Code motion
-
Strength reduction
-
Variable propagation
-
Interchanging of statements
-
Dead-code elimination
A
Correct answer
Explanation
Code motion moves the evaluation of expressions from one part of the program to another part of the program.
-
Syntax analysis
-
Semantic analysis
-
Symbol table
-
Code optimization
-
Intermediate code generation
D
Correct answer
Explanation
Code optimization generates errors like not reachable statements due to wrongly written function calls etc.
-
Divide by zero
-
Semantic error
-
Pointers going
-
Indices going
-
Infinite loop
B
Correct answer
Explanation
Semantic error is a compile time error.
-
Boxing
-
Unboxing
-
Identifier
-
Literals
-
Array
A
Correct answer
Explanation
It means the conversion of a value type on the stack to an object type on the heap.
-
#define
-
#error
-
#warning
-
#undef
-
#if
D
Correct answer
Explanation
This directive is used to undefine any symbol used in the C# program which causes no effect of the symbol defined using #define directive.
-
if expression
text if true
-
expression if#
text if true
-
#if expression
text-if-true
-
#endif
-
#elif
C
Correct answer
Explanation
This is the correct method of using if statement as it requires #if directive to be used.
-
#undef
-
#warning
-
#define
-
#elif
-
#else
C
Correct answer
Explanation
This directive is used in C# to define a symbol, which can be used with the #if directive to evaluate any expression.
-
True
-
False
-
Sometimes
-
Can't say
-
None of these
B
Correct answer
Explanation
In Excel, macros CAN be used to validate cell values through VBA programming. The Data Validation feature can use custom formulas, and event macros like Worksheet_Change can check and validate cell contents when they're modified. The statement is false because Excel provides multiple ways to validate cell values using macros.
-
Dot(.)
-
Pointer (&)
-
Pointer (*)
-
Arrow (->)
-
Not(~)
D
Correct answer
Explanation
Arrow (->) operator is used to access a structure element using a pointer.
-
from the innermost loop or switch
-
only from the innermost switch
-
only from the innermost loop
-
from the program
-
from the outermost loop
A
Correct answer
Explanation
The break statement is a jump statement which causes an exit from the innermost loop or switch.
-
Comma operator ( , )
-
Dot operator( . )
-
Cast operator
-
Address of operator (&)
-
Pointer operator( * )
A
Correct answer
Explanation
Comma operator ( , ) causes a sequence of operations to be performed.
-
Do...while loop
-
For loop
-
While loop
-
Nested loop
-
If statement
B
Correct answer
Explanation
For loop executes a sequence of statements multiple times and abbreviates the code that manages the loop variable.
-
a is pointer to integer
-
a is pointer to an array of pointers to integer
-
a is pointer to function which returns integer
-
a is a pointer to array of size 5
-
an array of pointer to function returning pointer to function returning pointer to integer.
B
Correct answer
Explanation
This is the correct answer.
-
Line control
-
Pragma directive
-
Macro definitions
-
Conditional inclusions
-
Error directive
D
Correct answer
Explanation
Conditional inclusions preprocessor directives allows to include or discard part of the code of a program.