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

Multiple choice technology programming languages
  1. Procedures without EXPORT Keyword can be accessed by other modules within the program.

  2. Procedures with EXPORT Keyword can be accessed ONLY by the module in which it resides.

  3. Procedures can ONLY access local variables.

  4. None of the Above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Procedures without the EXPORT keyword are internal to the module and cannot be accessed by other modules, making option 1 incorrect. Procedures with EXPORT can be accessed by other modules, making option 2 incorrect. Procedures can access global variables, making option 3 incorrect. Thus, 'None of the Above' is correct.

Multiple choice technology programming languages
  1. RPG Cycle code is not inserted which will affect the performance.

  2. RPG Cycle code is inserted which will affect the performance.

  3. RPG Bike code is inserted which will not affect the performance.

  4. None of the above.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Calling a dynamic program (using CALL in RPG) does not compile or bind the called program at compile time. RPG Cycle code references and dynamic invocation details don't insert RPG Cycle code into the calling code in a performance-inhibiting way. 'None of the above' is correct.

Multiple choice technology programming languages
  1. A subroutine can execute another subroutine, can contain another subroutine and shared by other programs.

  2. A subroutine can execute another subroutine, cannot contain another subroutine and shared by other programs.

  3. A subroutine can execute another subroutine, can contain another subroutine and is not shared by other programs.

  4. A subroutine can execute another subroutine, cannot contain another subroutine and is not shared by other programs.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

In RPG/400, subroutines cannot contain other subroutines - they must be defined at the main program level only. A subroutine can execute/call another subroutine (that's allowed), but it cannot define/contain a subroutine within itself. Subroutines are not shared across programs - they are internal to the program that defines them. Option D correctly states: can execute another subroutine, cannot contain another subroutine, and is not shared.

Multiple choice technology programming languages
  1. A structure that has the same data type

  2. A Line which used the type declaration

  3. A blank line in the print screen

  4. none of the above

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The line type of an internal table defines the structure of each row - it specifies what data fields each row contains and their types. Option A correctly describes it as a structure with matching data types. The other options describe incorrect or unrelated concepts.

Multiple choice technology programming languages
  1. Use statement CLEAR

  2. Var = 0.

  3. initialize var.

  4. VALUE is INITIAL

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

CLEAR is the standard ABAP statement to reset a variable to its initial value regardless of its data type. Setting var = 0 only works for numeric variables, initialize var is syntactically invalid, and VALUE IS INITIAL is used in conditional expressions rather than assignments.

Multiple choice technology programming languages
  1. P

  2. F

  3. D

  4. I

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In ABAP, when 'fixed point arithmetic' is set to true, it affects how packed numbers (type P) are handled. Packed numbers store decimal values with fixed precision, and the fixed point arithmetic setting determines how calculations and rounding are performed. The question asks which data type is affected, and the answer is P (packed number). Types F (floating point), D (date), and I (integer) are not affected by this setting.

Multiple choice technology programming languages
  1. a. LINE will hold the first record.

  2. b. Error

  3. c. LINE will hold the last record.

  4. d. LINE is empty.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

In the LOOP AT ITAB INTO LINE construct, the work area LINE receives each row of the internal table during each iteration. After the loop completes, LINE contains the last record that was processed. This is standard ABAP behavior - the work area holds whatever value was last assigned to it. Option A is incorrect because LINE only temporarily holds one record at a time during iteration. Option B is incorrect because no error occurs. Option D is incorrect because LINE contains the last processed record, not nothing.

Multiple choice technology web technology
  1. Faster

  2. Slower

  3. The execution speed is similar

  4. All of above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

To answer this question, the user needs to know the difference between a compiled program and a script.

A compiled program is a set of machine-readable instructions that are generated by a compiler from high-level programming language source code. The compiled program is then executed directly by the computer's CPU.

On the other hand, a script is a set of instructions written in a programming language that is interpreted by an interpreter at runtime. The interpreter reads and executes the code line by line instead of generating machine code.

Now, let's go through each option and explain why it is right or wrong:

A. Faster: This option is generally incorrect. Compiled programs are usually faster than scripts because they are already translated into machine code. The computer can execute machine code directly, which is faster than interpreting source code line by line.

B. Slower: This option is generally correct. Scripts are usually slower than compiled programs because they need to be interpreted at runtime. The interpreter has to read and execute the code line by line, which is slower than executing machine code directly.

C. The execution speed is similar: This option is generally incorrect. In most cases, compiled programs are faster than scripts. However, there may be some cases where the execution speed is similar, such as when the compiled program is poorly optimized or the script is highly optimized.

D. All of the above: This option is incorrect. Option A and C contradict each other, so they cannot both be correct. Option B is generally correct, but there may be some rare cases where a script is faster than a poorly optimized compiled program.

Therefore, the correct answer is:

The Answer is: B. Slower

Multiple choice technology web technology
  1. $get
  2. $ask
  3. $request
  4. $post
Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

PHP has several predefined superglobal variables: $_GET, $_POST, $_REQUEST, $_SERVER, $_SESSION, etc. These are auto-populated by PHP. The variable '$ask' is NOT a predefined PHP variable - it would need to be created by the developer. Options A, C, and D all refer to common PHP superglobals (though they should be written as $_GET, $_POST, $_REQUEST with underscores and in uppercase). The question tests knowledge of built-in versus custom variables.

Multiple choice technology web technology
  1. It can never be changed or undefined

  2. It can never be changed but can be undefined

  3. It can be changed but can not be undefined

  4. It can be changed and can be undefined

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

Once a constant is defined in PHP using define(), it cannot be changed or undefined during script execution. This is the fundamental purpose of constants - to provide immutable values that remain consistent throughout the program. Option B is wrong because constants cannot be undefined either. Options C and D are incorrect because constants cannot be changed at all after definition. Constants are global in scope and their value is fixed for the entire script runtime.

Multiple choice technology mainframe
  1. Nothing, the program will behave normally.

  2. The program will go in an infinite loop

  3. The program will not get complied.

  4. Output files wont be generated.

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

GO BACK returns control to the calling program. In a standalone program (not called by another program), there's no caller to return to, so GO BACK causes undefined behavior - typically an infinite loop or abnormal termination. STOP RUN is the correct statement to terminate a standalone COBOL program. Option A is incorrect because the behavior is not normal. Option C is wrong - it will compile fine. Option D is incorrect - output may be generated before the GO BACK executes.

Multiple choice technology mainframe
  1. Use IF ABEND statement in the JCL

  2. Use COND

  3. Both a and b

  4. None

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

To trap and conditionally handle abends in JCL, you use the IF ABEND=TRUE statement (or similar syntax depending on JCL variant). This allows conditional execution based on whether an abend occurred. COND is used for job/step condition codes, not specifically for abend trapping. Option C claims both work, but IF ABEND is the direct abend-trapping mechanism. I'm marking this with medium confidence because JCL syntax varies.

Multiple choice technology web technology
  1. function myFunction()

  2. function:myFunction()

  3. function=myFunction()

  4. myFunction()

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

function myFunction() is the correct JavaScript syntax for creating a function declaration. This syntax defines a function that can be called later. Option B incorrectly uses a colon, Option C uses an equals sign (variable assignment syntax without the function keyword properly), and Option D is just a function call without any declaration. JavaScript requires specific syntax rules for function definitions.