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
-
It is allocated at compile time
-
Declaration and initialization is separated
-
It is allocated at runtime
-
all of these
C
Correct answer
Explanation
Read-only variables (const, readonly) are allocated at runtime in .NET, unlike compile-time constants. Option A is incorrect because compile-time allocation is for constants (const), not readonly fields. Option B is incorrect - readonly variables can be declared and initialized separately (declaration at field, initialization in constructor). Option D is false since the other options contradict each other and cannot all be true.
-
Dynamic CALL
-
Static CALL
-
Both A and B
-
None of the above
A
Correct answer
Explanation
To solve this question, the user needs to have knowledge of the COBOL programming language and the different types of CALL statements used in it.
The CANCEL statement is used to cancel an active COBOL program, either from within the program or by another program. Specifically, it is used to cancel a dynamic CALL statement.
Therefore, the correct answer is:
The Answer is: A. Dynamic CALL
-
static void doStuff(int... doArgs) { }
-
static void doStuff(int x, int... doArgs) { }
-
static void doStuff(int[] doArgs) { }
-
static void doStuff(int... doArgs, int y) { }
A,B
Correct answer
Explanation
In Java, varargs (int...) must be the last parameter in a method signature. Option A is a simple varargs parameter - valid. Option B has a required parameter before varargs - valid because varargs is still last. Option C uses array syntax instead of varargs - syntactically valid but different semantics (would not match a varargs call in overloading). Option D is invalid because varargs cannot be followed by another parameter.
-
Block variables
-
Instance variables
-
Static variables
-
Local variables
C
Correct answer
Explanation
Static variables (class variables) are created when the class is loaded and persist until the program ends - they have the longest scope. Instance variables exist only as long as the object exists. Local (method) variables exist only during method execution. Block variables have the narrowest scope, existing only within their code block.
-
A. boolean
-
B. void
-
C. public
-
D. Button
C
Correct answer
Explanation
public is an access modifier, not a return type. Valid return types include primitive types like boolean, void, or object types like Button. Access modifiers control visibility, not what a method returns.
B
Correct answer
Explanation
According to ITF Rule 29, if a player breaks a string, they must finish the point with that racket or immediately replace it. If the returner stops to change a racket after a fault, the server is entitled to a first serve because the delay was caused by the receiver.
-
O'Really
-
Objective
-
Open
-
Order
-
Out
-
O - No Meaning
E
Correct answer
Explanation
GIGO stands for Garbage In, Garbage Out, where 'Out' is the correct O. This principle means that if you input flawed or nonsense data, you'll get flawed or nonsense output. The quality of output depends on the quality of input.
-
temporary
-
deviating
-
undeviating
-
variable
D
Correct answer
Explanation
Erratic means lacking consistency, regularity, or uniformity - something that changes unpredictably. "Variable" captures this meaning best as it refers to something that varies or changes, unlike "undeviating" which means constant or steady.
-
Subroutine
-
Compile
-
Null pointer
-
Interleave
D
Correct answer
Explanation
Interleave is a memory/disk term, not a programming concept. Subroutines, compile, and null pointers are core programming concepts. Interleaving refers to arranging data in non-contiguous patterns.
-
i will get a new compiler and try compiling again,
-
i will correct the error
-
i will write a new program to debug the compiler error
-
i will shutdown PC n have a kitkat break
-
No, values are assigned at run time
-
Yes, if the called set is a template test
-
No, you must delete called set and call it again
-
Yes, right click and choose called test parameters
D
Correct answer
Explanation
Quality Center allows you to modify the parameters of a called test by right-clicking on it and selecting 'called test parameters'. This enables you to customize the values passed to the called test during execution.
-
long
-
double
-
structures
-
All
-
a. Compilation Error - Struct cannot be defined inside a Function
-
b. Compilation Error - Struct cannot be defined without a name
-
c. 193149
-
d. 193149193149
C
Correct answer
Explanation
C allows struct definitions inside functions - these are local struct types. They can even be anonymous (no tag name) when defining a variable. The code creates an anonymous struct with member EmpNo, assigns 193149, and prints it. Output is 'EmpNo: 193149'.
-
1 3 4 6
-
1 3 4 6 7
-
2 4 6
-
1 3 4 7
D
Correct answer
Explanation
C variable names must start with a letter or underscore, and can only contain letters, digits, and underscores. Invalid names: 1 (starts with digit), 3 (contains #), 4 (starts with digit), 7 (double is a reserved keyword). Valid names: 2 (a_n with underscore), 5 (a5), 6 (integer is not a reserved word in C). Options 1,3,4,7 are all invalid.
-
0
-
1
-
morethan 1
-
depends on number of arguments
B
Correct answer
Explanation
A C++ function can only return exactly one value. However, this single return value can be a compound type like struct, array, or tuple containing multiple values, or you can use output parameters/pointers to return multiple values indirectly. The function itself has exactly one return statement that returns one value.