Computer Knowledge
Programming Fundamentals
2,381 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
-
Serialization
-
Garbage Collection
-
Assemblies
-
Overriding
B
Correct answer
Explanation
.NET uses Garbage Collection to automatically manage memory allocation and deallocation. The GC periodically scans for unused objects and reclaims their memory, preventing memory leaks and simplifying development.
-
.NET Threading
-
.NET Remoting
-
.NET RMT
-
None of the above
B
Correct answer
Explanation
.NET Remoting enables communication between application domains, processes, or machines. It allows objects to interact across boundaries using different transport protocols and serialization formats, making distributed applications possible.
B
Correct answer
Explanation
The statement reverses the actual relationship. CTS (Common Type System) is a component OF CLR (Common Language Runtime), not something that CLR is built into. CLR is the execution environment that includes CTS as part of its type system. The False answer correctly identifies this error.
-
Searching directory paths
-
Cannot find each other by any method
-
By pointers
-
None of the Above
A
Correct answer
Explanation
In the .NET Framework, the Common Language Runtime (CLR) locates assemblies by searching directory paths, specifically looking in the application directory, private paths specified in configuration files, and the Global Assembly Cache (GAC).
-
TypeCov()
-
Type()
-
CTyp()
-
CType()
D
Correct answer
Explanation
CType is the VB.NET function for type conversion that works with compatible types. It performs both widening (safe) and narrowing (requires explicit cast) conversions. The other options are fictitious method names.
-
Constant
-
Const
-
Consta
-
Fixed
B
Correct answer
Explanation
Const is the VB.NET keyword for declaring constants - values that cannot be changed during program execution and must be initialized at declaration time. The other options are not valid VB.NET keywords for declaring constants.
-
Type boolean
-
Type float
-
Type byte
-
Type double
C
Correct answer
Explanation
In Java, the primitive integer types are byte, short, int, and long. float and double are floating-point types, while boolean is a logical type.
D
Correct answer
Explanation
In Java, 'public', 'static', and 'void' are reserved keywords that have special meaning in the language. 'main' is NOT a reserved keyword - it's simply the name of a method that is commonly used as the entry point for Java applications, but you could technically name a method 'main' in any class.
-
void method1 { /* ... */ }
-
void method2() { /* ... */ }
-
void method3(void) { /* ... */ }
-
method4() { /* ... */ }
B
Correct answer
Explanation
In Java, a valid method declaration requires a return type (or void), a method name, and a parameter list enclosed in parentheses, followed by the method body. void method2() { } correctly satisfies these syntax rules.
B
Correct answer
Explanation
Generic code problems are handled at compile-time, not runtime. Java uses type erasure where generic type information is removed during compilation. By the time the code runs, generic types are replaced with their bounds or Object, making runtime generic type checking impossible.
-
{{}} is a valid statement block
-
{ continue; } is a valid statement block
-
block: { break block; } is a valid statement block
-
block: { continue block; } is a valid statement block
A,C
Correct answer
Explanation
{{}} is valid - it's a nested empty block. { continue; } is invalid because continue must be inside a loop. block: { break block; } is valid - labeled break can exit any labeled block. block: { continue block; } is invalid because continue requires an enclosing loop, not just a labeled block.
-
(B) & (C)
-
(E)
-
(A) & (C)
-
(D)
C
Correct answer
Explanation
Java keywords are reserved words with special meaning. 'switch' and 'default' are valid keywords. 'integer' is not a keyword (int is the primitive type). 'boolean' is a keyword (primitive type). 'object' is not a keyword (Object is a class).
-
(D) & (E)
-
(A), (D) & (E)
-
(D)
-
(C), (D) & (E)
B
Correct answer
Explanation
In Java, NULL (should be null), extended (should be extends), and string (String is a class) are not keywords. 'implements' and 'protected' are valid Java keywords. Option B correctly identifies the three items that are not keywords.
-
(B) & (C)
-
b. (E)
-
c. (A) & (C)
-
d. (D)
C
Correct answer
Explanation
In Java, 'switch' and 'default' are valid keywords. 'integer' is not a keyword (int is), 'boolean' is a valid keyword (primitive type), and 'object' is not a keyword (Object is a class). Option C correctly identifies the keywords.
-
(D) & (E)
-
b. (A), (D) & (E)
-
c. (D)
-
d. (C), (D) & (E)
B
Correct answer
Explanation
In Java, implements and protected are keywords. NULL (all uppercase) is not a keyword (the literal is lowercase null), extended is not a keyword (the keyword is extends), and string is not a keyword (the class is String). Thus, (A), (D), and (E) are not keywords.