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
-
If the function exists, it will be dropped and replaced with the new version created by the statement.
-
If the function does not exist, it will create a new one.
-
No action will be taken
-
There is no such option available.
A
Correct answer
Explanation
The REPLACE clause tells the database to drop an existing function of the same name and create the new definition instead of raising an error. This is precisely what the stored answer describes, so it is correct.
-
Cons: Path_Dir, Vari: path_dir
-
Cons: PATH_DIR, Vari: path_dir
-
Cons: Path_Dir, Vari: PATH_DIR
-
Cons: PATH_dir, Vari: path_DIR
B
Correct answer
Explanation
The standard naming convention across programming languages is that constants use ALL_CAPS_WITH_UNDERSCORES (PATH_DIR) while variables use lowercase_with_underscores (path_dir). This makes constants easily distinguishable from variables in code and improves readability.
-
Procedures do not return values
-
Functions do not return values
-
Procedure always return values
-
None of these.
A
Correct answer
Explanation
Historically, functions must return a value, while procedures do not. Note that procedures can return values via OUT parameters in many databases, but standard definition-level differentiation is that procedures do not return values directly via a RETURN statement.
-
Both are same
-
case can check for non equality operator but decode checks for equality operator
-
decode can be used for comparing value of one variable/condition. but case can check for multiple conditions
-
case can not be used in where clause. but decode can be used.
B,C
Correct answer
Explanation
In PL/SQL and SQL, CASE statements support complex logical conditions and non-equality operators (like < or >), whereas DECODE is limited to equality checks. CASE also handles multiple distinct conditions. Distractors incorrectly equate them.
-
Buil-in
-
User-defined
-
User-function
-
Buil-in,User-defined
D
Correct answer
Explanation
QuickTest supports two types of environment variables: built-in variables provided by the system, and user-defined variables created by testers. This combination allows flexibility in test configuration.
B
Correct answer
Explanation
In DataStage, when a sequential file stage encounters a null value and the NullFieldValue property is not assigned, the row gets rejected. If no reject link is attached to handle rejected rows, the job aborts with a fatal error. This behavior ensures data quality by stopping execution rather than writing incomplete or inconsistent data.
A
Correct answer
Explanation
The main method CAN be overloaded - you can have multiple methods named 'main' with different parameter lists. However, only the standard main(String[] args) serves as the JVM entry point. Other overloaded main methods must be called explicitly like any other method. This is a common confusion point.
A
Correct answer
Explanation
Java allows the main method to be declared with any of the usual modifiers, including final. Declaring it final simply prevents the method from being overridden, which never happens for static methods anyway, so the statement is valid. The stored answer (True) is therefore correct.
A
Correct answer
Explanation
Local variables have block scope in most languages (Java, C, C++). If two blocks are disjoint (not nested), they can each declare variables with the same name without conflict. Each variable is only visible within its own block. This is valid and commonly used.
-
Only IE
-
Only ST
-
Both IE and ST
-
None
-
int $x;
-
int 123;
-
int _123;
-
int #dim;
-
int %percent;
-
int central_sales_region_Summer_2005_gross_sales;
A,C,F
Correct answer
Explanation
In Java, valid identifiers can start with a letter, an underscore (_), or a currency symbol (like $). Subsequent characters can also include digits. Identifiers cannot start with a digit, and symbols like # or % are not allowed.
-
If only line 1 is removed the code compiles.
-
If only line 3 is removed the code compiles.
-
If only line 5 is removed the code compiles.
-
If lines 1 and 3 are removed the code compiles
-
If lines 1, 3 and 5 are removed the code compiles.
C,E
Correct answer
Explanation
Java doesn't allow enum declarations inside methods (line 5). Removing line 5 eliminates this syntax error, allowing compilation. Option C is correct. Removing all three enum declarations (lines 1, 3, 5) leaves only the class and method structure without any nested enums, which is valid Java - option E is correct. Options A, B, and D are incorrect because they still include the method-local enum declaration on line 5.
A
Correct answer
Explanation
In Java, statements that cannot be executed because they are after a return statement, loop exit, or within an branch that is statically known to be unreachable will cause a compile-time error.
A
Correct answer
Explanation
REXX programs can indeed be compiled using a REXX compiler for improved performance and code protection. While REXX is traditionally an interpreted language, compilers exist that translate REXX source to executable form. The statement is accurate - REXX supports both interpreted and compiled execution models.