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. FIFO

  2. LIFO

  3. both (a) and (b)

  4. None of the above

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

A stack follows LIFO (Last In, First Out) - the last element pushed onto the stack is the first one popped off. This is like a stack of plates where you add and remove from the top. FIFO describes a queue, not a stack.

Multiple choice technology programming languages
  1. For loop

  2. While loop

  3. if loop

  4. All the above

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

The break statement is used to exit from loops (for, while, do-while) and switch statements. It cannot be used with if statements because if is a conditional statement, not a loop. 'if loop' is incorrect terminology but the meaning is clear.

Multiple choice technology programming languages
  1. int

  2. public

  3. button

  4. void

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

The keyword public is an access modifier in languages like Java, C++, and C#, not a data type. Primitive types like int, object/component classes like button, and return types like void are all valid data types or type descriptors, making public the correct choice.

Multiple choice technology programming languages
  1. w var1

  2. w this.var1

  3. w ..var1

  4. w ..#var1

  5. w (classname).var1

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

In Cache ObjectScript, the syntax ..#var1 is used to reference class parameters with indirection. The ## (double dot) operator provides access to class parameters, while the # symbol allows for parameter reference. Option w (write) is the command to output the value, making w ..#var1 the correct syntax for writing a class parameter value.

Multiple choice technology databases
  1. LENGTH

  2. CONCAT

  3. INSTR

  4. NULLIF

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

CONCAT can return non-NULL when passed NULL because it concatenates non-NULL values and ignores NULL arguments. For example, CONCAT('abc', NULL) returns 'abc'. LENGTH(NULL) returns NULL. INSTR with NULL returns NULL. NULLIF returns NULL if its arguments are equal, otherwise the first argument.

Multiple choice technology web technology
  1. byte

  2. String

  3. integer

  4. Float

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

In Java, primitive types are the basic data types built into the language: byte, short, int, long, float, double, char, boolean. String is a class (reference type). integer is not a valid Java type (it should be int). Float is a wrapper class, not a primitive (float is the primitive).

Multiple choice technology web technology
  1. byte

  2. String

  3. integer

  4. Float

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

In Java, primitive types are the basic data types built into the language: byte, short, int, long, float, double, char, and boolean. Among the options, only 'byte' is a primitive type. 'String' is a class, 'integer' is not a valid keyword (the primitive is 'int'), and 'Float' is a wrapper class (the primitive is 'float').

Multiple choice technology web technology
  1. scriptlets

  2. declarations

  3. implicit objects

  4. expressions

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

In JSP, implicit objects (also called predefined variables) are automatically available to JSP pages without declaration. These include request, response, session, application, out, config, page, and pageContext. They are called 'implicit' because the container creates them automatically - developers don't need to declare or instantiate them.

Multiple choice technology programming languages
  1. for

  2. break

  3. continue

  4. Structure

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

Java keywords are reserved words with specific meanings in the language. 'for', 'break', and 'continue' are built-in control flow keywords. 'Structure' is not a keyword in Java (unlike 'struct' in C/C++). Note that Java keywords are case-sensitive and lowercase.

Multiple choice technology mainframe
  1. Marks the beginning of one or more program control statements

  2. Identifies the control card library

  3. Delimits the PROC control statements

  4. None of the above

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

The //CNTL statement in JCL marks the beginning of one or more JCL control statements that will be interpreted by the system. It is used to introduce a section of control statements that need to be processed together. It is not specifically for identifying control card libraries (that would be different JCL constructs) or for delimiting PROC definitions (which use other statements).

Multiple choice technology mainframe
  1. Through the RC keyword

  2. Through the COND keyword

  3. Through the CODE keyword

  4. Through the RETURNCD keyword

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

The COND parameter in JCL is used to test return codes from previous job steps before executing the current step. It allows conditional execution based on success or failure of prior steps. RC, CODE, and RETURNCD are not valid JCL keywords - COND is the standard mechanism for conditional step execution based on return codes.

Multiple choice technology mainframe
  1. Linkage Variables

  2. Control Libraries

  3. Includes

  4. Parameters

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

JCL statements use parameters (both keyword and positional) to specify values directing statement execution, such as naming datasets or programs. Options like linkage variables, control libraries, and includes serve separate functions in program linkage or file organization.