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
-
float ptr
-
float *ptr
-
*float ptr
-
none of these
B
Correct answer
Explanation
In C, a pointer variable is declared by placing an asterisk before the variable name, such as float *ptr.
-
address of operator
-
value at address
-
address of a variable
-
none of these
B
Correct answer
Explanation
The asterisk (*) operator, when used in pointer notation, is the dereference operator, which retrieves the value stored at the memory address held by the pointer.
-
inside the function
-
outside the function
-
within the function
-
none of these
B
Correct answer
Explanation
Pointers allow functions to modify variables defined outside their local scope by passing the memory address of those variables.
-
puts( );
-
gets( );
-
getchar( );
-
none of these
C
Correct answer
Explanation
The getchar() function is specifically designed to read a single character from the standard input.
-
's' is a float variable
-
's' is going to contain a floating point value
-
's' contains the address of a floating point variable
-
none of these
C
Correct answer
Explanation
The declaration float *s defines s as a pointer to a float, meaning it holds the memory address where a float value is stored.
-
scanf( )
-
gets( );
-
getchar( );
-
getche( );
A
Correct answer
Explanation
The scanf() function is the standard library function used to read formatted input, including integers, from the keyboard.
-
LIFO
-
FIFO
-
LILO
-
None of these
A
Correct answer
Explanation
A stack is defined by its LIFO (Last In First Out) access pattern.
-
evaluate an arithmetic expression in postfix form
-
implement recursion
-
convert a given arithmetic expression in infix form to its equivalent postfix form
-
allocate resources (like CPU) by the operating system
C
Correct answer
Explanation
While stacks are used for expression evaluation and recursion, resource allocation (like CPU scheduling) is typically handled by queues to ensure fairness.
-
For … Next Statement
-
Do… While Statement
-
If …Then Statement
-
None of these
D
Correct answer
Explanation
In VB 6, a Sub procedure performs actions but does not return a value to the caller, unlike a Function procedure which returns a value.
-
String
-
Integer
-
Variant
-
Double
A
Correct answer
Explanation
In VB, the '$' suffix is a type-declaration character for String. Therefore, Triangle$ declares a function that returns a String.
-
Private Pseudo ( )
-
Private Function Pseudo ( )
-
Pseudo ( )
-
Function Pseudo@ ( )
-
Dim arrstu (20) as Integer
-
Dim arr(k) as Double
-
Dim arrstu ( 1 To 20) as String
-
Dim arrstu (2)
B
Correct answer
Explanation
Option B uses a variable 'k' inside the array declaration without it being defined or constant, which is invalid in standard VB array declarations.
-
Private Sub Month( )
-
Call Month ( )
-
Sub Dis_statement ( ) As Integer
-
Sub FindError (intsal as Integer)
D
Correct answer
Explanation
Option D is a valid Sub-procedure declaration with a parameter. Option A is also valid, but D is more descriptive of a procedure with parameters.
-
They use dynamic allocation for variable
-
They use static allocation for variable
-
Stacks are not available on all machines
-
It is not possible to implement recursion on all machine
A
Correct answer
Explanation
Recursion requires a new set of local variables for each function call, which is managed by dynamic allocation on the stack.