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 databases
  1. Package and function

  2. Function and userexit

  3. Procedure and package

  4. Function and procedure

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

In relational database systems like DB2, routine objects include user-defined functions and procedures. Packages are compiled objects containing SQL statements, not routines themselves, while userexits are external programs for task-specific processing rather than standard routine objects.

Multiple choice technology programming languages
  1. True

  2. False

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

The code uses tryVariableArguments.arguments which is an obsolete, deprecated syntax. In modern JavaScript (and even in older implementations), the correct way is to use the arguments object directly within the function, not as a property of the function name. This code will fail in contemporary browsers.

Multiple choice technology programming languages
  1. True

  2. False

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

JavaScript functions are first-class objects and their names are identifiers within the same scope. Declaring a function and variable with the same name causes a namespace collision where one overrides the other. Because JavaScript does not separate these namespaces, it does not distinguish between them.

Multiple choice technology programming languages
  1. True

  2. False

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

parseJSON is not a standard built-in JavaScript function. The standard method for parsing JSON strings is JSON.parse(). The parseJSON function might have existed in some non-standard implementations or specific libraries, but it's not part of core JavaScript like alert() or eval().

Multiple choice technology programming languages
  1. a.SAS continues processing the step.

  2. a.SAS continues to process the step, and the SAS log displays messages about the error.

  3. a.SAS stops processing the step in which the error occurred, and the SAS log displays messages about the error.

  4. SAS stops processing the step in which the error occurred, and the Output window displays messages about the error.

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

When SAS encounters a syntax error, it immediately stops processing the step containing the error, prints warning or error messages to the SAS log, and continues checking subsequent steps. It does not output these messages to the Output window.

Multiple choice technology
  1. True

  2. False

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

Nested functions are NOT allowed in standard C. While some compilers (like GCC) support nested functions as an extension, they are not part of the C language standard. C was designed to be a simple language with functions that can only be defined at file scope, not inside other functions.

Multiple choice technology
  1. True

  2. False

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

This is the correct syntax for declaring a function pointer in C. 'int (*pt2Function) (float, char, char)' declares pt2Function as a pointer to a function that takes a float and two char parameters and returns an int. The parentheses around *pt2Function are crucial - they make it a pointer to a function rather than a function returning a pointer.

Multiple choice technology
  1. True

  2. False

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

Two function pointers can indeed be compared using the == operator. This checks if they point to the same function address. If both pointers point to the same function, the comparison returns true; otherwise, it returns false. This is valid and commonly used in C programming.

Multiple choice technology programming languages
  1. Code Area

  2. Data Area

  3. Stack Area

  4. Heap Area

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

In Java's memory model, local primitive variables and local reference variables are stored in the Stack Area. Each thread has its own stack, where method frames containing local variables and partial results are pushed when methods are invoked. The Heap stores objects, Code Area stores bytecode, and Data Area stores static/class variables.

Multiple choice technology testing
  1. the use of a variable before it has been defined

  2. unreachable (“dead”) code

  3. memory leaks

  4. array bound violations

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

Static analysis analyzes source code without executing it. It can find syntax errors, dead code, undefined variables, and array bound violations. However, memory leaks are dynamic run-time anomalies that static analysis cannot reliably identify, requiring dynamic execution to detect accurately.

Multiple choice technology mainframe
  1. Scan - check the syntax error and will hold the job, Hold - Checks the syntax error

  2. Scan - will hold the Job, Hold - check for the syntax error

  3. Scan - checks the syntax error, Hold - will hold the job if there is no error and will end with JCL error if there is syntax error

  4. Scan and Hold both will check the syntax error and none of them will hold the job

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

TYPRUN=SCAN checks JCL syntax without executing the job. TYPRUN=HOLD also checks syntax but holds the job in input queue if error-free, or issues JCL error if syntax errors exist. Neither option actually holds a job with errors - SCAN just reports, HOLD only holds if syntax is valid.

Multiple choice technology mainframe
  1. Scan - check the syntax error and will hold the job, Hold - Checks the syntax error

  2. Scan - will hold the Job, Hold - check for the syntax error

  3. Scan - checks the syntax error, Hold - will hold the job if there is no error and will end the job with JCL error if there is syntax error

  4. Scan and Hold both will check the syntax error and none of them will hold the job

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

TYPRUN=SCAN checks JCL syntax without executing the job. TYPRUN=HOLD also checks syntax but holds the job in input queue if error-free, or issues JCL error if syntax errors exist. This is nearly identical to question 153673 with slight wording difference ('end the job with' vs 'end with').

Multiple choice technology testing
  1. 8

  2. 5

  3. 7

  4. 6

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

This program has 5 decision points (IF A>=10, ELSEIF B>5, ELSEIF A>B, ELSE IF B>A, and the implicit ELSE). To achieve decision coverage, each decision must be tested with both true and false outcomes. The minimum 5 test cases are: (1) A>=10 true, (2) A<10, B>5 true, (3) A<10, B<=5, A>B true, (4) A<10, B<=5, A<=B, B>A true, (5) All conditions false (A=B). Option A (8) is for multiple condition coverage, while C (7) and D (6) don't account for all decision branches.

Multiple choice technology databases
  1. NEW_LINE

  2. PUT

  3. PUT_LINE

  4. PUTF

  5. None of the above

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

PUT_LINE in UTL_FILE package writes text to a file and automatically appends a line terminator (newline character) after each call. PUT writes without any terminator, while PUTF is for formatted output without automatic line termination. NEW_LINE is not a valid UTL_FILE procedure.