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
-
call by value
-
call by reference
-
call by address
-
All the Above
B
Correct answer
Explanation
When you pass pointers to a function, the function receives the address of the original variable. The function can access and modify the original data through that address. Call by value copies the actual parameter, call by address means passing pointers explicitly.
-
Inline functions
-
virtual functions
-
Both A and B
-
None of the Above
A
Correct answer
Explanation
An inline function suggests to the compiler that the function's code should be inserted directly at the point of call to eliminate function call overhead. Virtual functions support dynamic dispatch instead of inline substitution, and the other options are incorrect.
-
string
-
complex
-
double
-
float
C
Correct answer
Explanation
Python's built-in numeric types are int, float, and complex. The type 'double' does not exist in Python - it uses 'float' for double-precision floating-point numbers. String, complex, and float are all valid Python types.
D
Correct answer
Explanation
This question is poorly framed, but 'lib' is not a built-in Python structural element or syntax construct, whereas 'list' is a built-in type, 'module' is a structure for organization, and 'sequence' is a generic type category. Thus, 'lib' is marked as the invalid structure.
B
Correct answer
Explanation
Python function definitions start with the keyword def followed by the function name. Keywords like function, void, and func are used in other programming languages but are invalid for defining functions in Python.
-
public
-
private
-
global
-
protected
A
Correct answer
Explanation
Python variables are public by default. Unlike languages like Java or C++, Python doesn't enforce access modifiers at the language level, relying on naming conventions instead.
-
Prefix the string 'private' to the variable name.
-
initialize it with '_init_private'
-
initialize it with double underscore '__'
-
append the keyword 'pvt' before the variable.
C
Correct answer
Explanation
Python uses name mangling with double underscore prefix (__) to indicate private variables. This makes the variable harder to access from outside the class, though it's still technically possible.
B
Correct answer
Explanation
In Python, you cannot skip parameters when providing positional arguments. To assign values to non-trailing parameters, you must use keyword arguments (parameter_name=value).
-
a match case is found
-
a match case is found and break is encountered
-
will continue till default
-
none
B
Correct answer
Explanation
In a switch statement, execution continues through all cases after a match until a break statement is encountered. This 'fall-through' behavior means without break, multiple case blocks execute sequentially.
B
Correct answer
Explanation
Final methods in Java CANNOT be overridden by subclasses. The final keyword specifically prevents modification - it's the entire purpose. When a method is declared final, subclasses must use it as-is and cannot provide their own implementation. Therefore the answer 'False' to 'Can final method be overridden?' is correct.
-
Watch
-
View
-
Locate
-
Current
A
Correct answer
Explanation
The Watch tab in the Debug Viewer allows you to monitor the current value of specific variables or VBScript expressions during test execution. You can add variables to the watch list to track their values in real-time.