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
C
Correct answer
Explanation
The CLR (Common Language Runtime) is where .NET code actually executes. It provides services like memory management, security, and JIT compilation. MSIL (Microsoft Intermediate Language) is the compiled code format, CLS (Common Language Specification) defines language interoperability rules, and CTS (Common Type System) defines type system rules - none of these execute code directly.
-
double
-
Switch
-
then
-
instanceof
A,D
Correct answer
Explanation
double and instanceof are valid Java keywords. Switch is incorrect (must be lowercase 'switch'). 'then' is not a Java keyword (it's used in some other languages but not Java).
-
It offers option of sharing local variables and better run time efficiency
-
Provides benefit of automatic recompilation
-
It is processed during translation and compilation and does not impose any restrictions on output buffering
-
none of the above
A
Correct answer
Explanation
The JSP include directive (<%@ include file="..." %>) merges the content of the target file into the calling page during translation. This allows sharing of local variables and offers better runtime efficiency compared to dynamic inclusion.
A
Correct answer
Explanation
The System.arraycopy() method in Java is a native method used to efficiently copy data from a source array to a destination array.
-
return
-
break
-
goto
-
continue
C
Correct answer
Explanation
Java has 'goto' as a reserved keyword but it is not implemented as a branching statement - it has no functionality. 'return', 'break', and 'continue' are all valid branching statements that control flow. The question asks which is NOT a branching statement, making 'goto' (option C) the correct answer despite being syntactically reserved but unusable.
-
DATA STACK
-
QUEUE
-
COMPOUND VARIABLE
-
SYMBOLIC VARIABLE
A
Correct answer
Explanation
In REXX, the DATA STACK can be used for file I/O operations - you can PUSH lines to write to a file and PULL/QUEUE to read from a file. QUEUE is used for stack manipulation but not direct file I/O. COMPOUND and SYMBOLIC variables are data types, not I/O mechanisms.
-
INTERPRET
-
ITERATE
-
CALL
-
LEAVE
C
Correct answer
Explanation
In REXX and many other programming languages, the CALL instruction is used to transfer control to a subroutine or function.
-
EXECUTE
-
INTERPRET
-
RUN
-
CALL
B
Correct answer
Explanation
INTERPRET is the correct REXX instruction that dynamically executes a string containing REXX code. EXECUTE, RUN, and CALL are not valid REXX instructions - CALL invokes subroutines but doesn't interpret code strings. The code 'DO 3; SAY "HELLO THERE!"; END' would print the message three times.
-
Subroutine should start with this instruction
-
To convert all the local variables in the subroutine as global variables
-
To convert all the variables used in subroutine as local variables
-
Function should start with this instrucion
A
Correct answer
Explanation
The PROCEDURE instruction in REXX starts an internal subroutine and protects its variables by making them local to that subroutine. Without PROCEDURE, variables in a subroutine are global. PROCEDURE does not convert global variables to local - it creates a new local variable scope.
-
Python is faster than C
-
Python is faster than C++
-
Python is slower than C
-
None of the above
C
Correct answer
Explanation
Python is an interpreted language that translates code at runtime, while C is a compiled language that translates to machine code beforehand. This compilation step makes C significantly faster than Python for most operations.
-
get+find
-
find
-
find+get
-
none of the above
C
Correct answer
Explanation
In IDMS DMS database operations, a Fetch operation is conceptually equivalent to 'find+get'. First you find (locate) the record, then you get (retrieve) it. This two-step process characterizes the fetch operation in DMS databases. Option A has the order wrong, option B is incomplete, and option D is incorrect.
A
Correct answer
Explanation
In vi editor, named registers (buffers) like 'a', 'b', etc. can be specified before deletion, change, yank, or put operations by prefixing the register name in double quotes. For example, 'adw' deletes a word into register 'a', and 'ap' puts contents of register 'a'. This is a core feature of vi's text manipulation system.
B
Correct answer
Explanation
The main() method can be overloaded (different signatures) but the standard String[] variant from Object cannot be overridden because it's static. Static methods belong to the class definition, not instances - no virtual method table lookup.
B
Correct answer
Explanation
Comparing with Float.NaN using == always returns false (even Float.NaN == Float.NaN is false by IEEE 754). Float.isNaN(x) is the correct way to check. The claimed answer B is correct.
A
Correct answer
Explanation
For a REPEAT operation to execute continuously until the repeat condition becomes false (not remains true), the count parameter must be set to -1. A -1 value indicates unlimited repetition, allowing the loop to continue executing until the condition changes.