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
-
value
-
reference
-
both of the above
-
none of the above
B
Correct answer
Explanation
In C, arrays are passed to functions by passing the address of the first element, which is effectively passing by reference.
-
ending of the loop
-
beginning of the loop
-
middle of the loop
-
none of the above
B
Correct answer
Explanation
In a do-while loop, the 'do' keyword marks the beginning of the loop block, while the condition is checked at the end.
-
if statement
-
if - else statement
-
switch statement
-
none of the above
C
Correct answer
Explanation
The switch statement is the standard C construct for multiway branching, allowing a variable to be tested for equality against a list of values.
-
local
-
global
-
both of the above
-
none of the above
A
Correct answer
Explanation
Local variables are defined within a specific function or block and are only available within that scope, making them suitable for specific, short tasks.
-
address of a varible
-
indication of a variable
-
variable which stores the address of another variable
-
none of the above
C
Correct answer
Explanation
A pointer is a variable that stores the memory address of another variable, allowing indirect access to the data stored at that address.
-
LIFO
-
FIFO
-
FILO
-
None of the above
A
Correct answer
Explanation
A stack is a linear data structure that follows the Last-In, First-Out (LIFO) principle, where the last element added is the first one to be removed.
A
Correct answer
Explanation
The dot operator (.) is used to access members of a structure or union variable.
-
functions
-
array
-
structure
-
union
-
data
-
program
-
procedure
-
none of these
A
Correct answer
Explanation
In declarative representation, knowledge is represented as a collection of facts or assertions. These are treated as data that can be queried or manipulated by a separate inference engine.
-
Imperative statement
-
Declarative statement
-
Assembler directives
-
Either Declarative statement or Assembler directives
-
None of these
A
Correct answer
Explanation
This statement indicates an action to be performed during the execution of the assembled program.
-
(a) system call
-
(b) priviliged instruction
-
(c) floating poitnt exception
-
(d) all the above
-
ch contains the address of char variable
-
ch is a char variable
-
ch is going to contain a char value
-
none of these
-
scanf(“%s”,str);
-
gets(str);
-
getche(str);
-
fgetchar(str);
B
Correct answer
Explanation
gets() is the appropriate function to read a string containing spaces from the keyboard into a character array.
-
pointer to a variable
-
pointer variable
-
pointer to an int pointer
-
none of these
A
Correct answer
Explanation
To swap two variables (a and b), you typically use one temporary variable (temp = a; a = b; b = temp;). While XOR swapping can be done with zero extra variables, the standard algorithmic approach taught in introductory programming uses one.