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 c sharp
  1. It is allocated at compile time

  2. Declaration and initialization is separated

  3. It is allocated at runtime

  4. all of these

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

Read-only variables (const, readonly) are allocated at runtime in .NET, unlike compile-time constants. Option A is incorrect because compile-time allocation is for constants (const), not readonly fields. Option B is incorrect - readonly variables can be declared and initialized separately (declaration at field, initialization in constructor). Option D is false since the other options contradict each other and cannot all be true.

Multiple choice cobol
  1. Dynamic CALL

  2. Static CALL

  3. Both A and B

  4. None of the above

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

To solve this question, the user needs to have knowledge of the COBOL programming language and the different types of CALL statements used in it.

The CANCEL statement is used to cancel an active COBOL program, either from within the program or by another program. Specifically, it is used to cancel a dynamic CALL statement.

Therefore, the correct answer is:

The Answer is: A. Dynamic CALL

Multiple choice java
  1. static void doStuff(int... doArgs) { }

  2. static void doStuff(int x, int... doArgs) { }

  3. static void doStuff(int[] doArgs) { }

  4. static void doStuff(int... doArgs, int y) { }

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

In Java, varargs (int...) must be the last parameter in a method signature. Option A is a simple varargs parameter - valid. Option B has a required parameter before varargs - valid because varargs is still last. Option C uses array syntax instead of varargs - syntactically valid but different semantics (would not match a varargs call in overloading). Option D is invalid because varargs cannot be followed by another parameter.

Multiple choice java
  1. Block variables

  2. Instance variables

  3. Static variables

  4. Local variables

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

Static variables (class variables) are created when the class is loaded and persist until the program ends - they have the longest scope. Instance variables exist only as long as the object exists. Local (method) variables exist only during method execution. Block variables have the narrowest scope, existing only within their code block.

Multiple choice method return type
  1. A. boolean

  2. B. void

  3. C. public

  4. D. Button

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

public is an access modifier, not a return type. Valid return types include primitive types like boolean, void, or object types like Button. Access modifiers control visibility, not what a method returns.

Multiple choice general knowledge sports
  1. True

  2. False

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

According to ITF Rule 29, if a player breaks a string, they must finish the point with that racket or immediately replace it. If the returner stops to change a racket after a fault, the server is entitled to a first serve because the delay was caused by the receiver.

Multiple choice general knowledge science & technology
  1. O'Really

  2. Objective

  3. Open

  4. Order

  5. Out

  6. O - No Meaning

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

GIGO stands for Garbage In, Garbage Out, where 'Out' is the correct O. This principle means that if you input flawed or nonsense data, you'll get flawed or nonsense output. The quality of output depends on the quality of input.

Multiple choice general knowledge
  1. temporary

  2. deviating

  3. undeviating

  4. variable

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

Erratic means lacking consistency, regularity, or uniformity - something that changes unpredictably. "Variable" captures this meaning best as it refers to something that varies or changes, unlike "undeviating" which means constant or steady.

Multiple choice general knowledge science & technology
  1. No, values are assigned at run time

  2. Yes, if the called set is a template test

  3. No, you must delete called set and call it again

  4. Yes, right click and choose called test parameters

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

Quality Center allows you to modify the parameters of a called test by right-clicking on it and selecting 'called test parameters'. This enables you to customize the values passed to the called test during execution.

Multiple choice general knowledge
  1. a. Compilation Error - Struct cannot be defined inside a Function

  2. b. Compilation Error - Struct cannot be defined without a name

  3. c. 193149

  4. d. 193149193149

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

C allows struct definitions inside functions - these are local struct types. They can even be anonymous (no tag name) when defining a variable. The code creates an anonymous struct with member EmpNo, assigns 193149, and prints it. Output is 'EmpNo: 193149'.

Multiple choice general knowledge science & technology
  1. 1 3 4 6

  2. 1 3 4 6 7

  3. 2 4 6

  4. 1 3 4 7

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

C variable names must start with a letter or underscore, and can only contain letters, digits, and underscores. Invalid names: 1 (starts with digit), 3 (contains #), 4 (starts with digit), 7 (double is a reserved keyword). Valid names: 2 (a_n with underscore), 5 (a5), 6 (integer is not a reserved word in C). Options 1,3,4,7 are all invalid.

Multiple choice general knowledge science & technology
  1. 0

  2. 1

  3. morethan 1

  4. depends on number of arguments

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

A C++ function can only return exactly one value. However, this single return value can be a compound type like struct, array, or tuple containing multiple values, or you can use output parameters/pointers to return multiple values indirectly. The function itself has exactly one return statement that returns one value.