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
  1. Exit

  2. Break

  3. Return

  4. Jump

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

The Break statement is used in PowerShell to exit loop constructs like ForEach, For, While, Do-While, and Switch statements. Exit terminates the entire script or console session. Return exits a function or script block. Jump is not a valid PowerShell keyword for loop control.

Multiple choice technology
  1. Variables in the global scope are visible in all scopes

  2. Variables in the script scope are visible to all scopes within that script file.

  3. Variables in the local scope are visible only in the current scope and not to its children.

  4. Private scope variables are visible only to that current scope.

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

Global scope variables are accessible from anywhere in PowerShell. Script scope variables are visible throughout the script file. The statement C is incorrect because local scope variables ARE inherited by child scopes - they remain visible in nested scopes. Private scope is the only scope that doesn't inherit to children.

Multiple choice technology
  1. Mandatory

  2. Named

  3. Generic

  4. Positional

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

PowerShell parameter attributes include Mandatory, Positional, and Named (parameters you specify by name). Generic is not a valid PowerShell parameter type - there is no [Generic()] attribute in PowerShell. Parameter types can be string, int, bool, etc., but Generic is not a parameter classification.

Multiple choice technology
  1. Tom drives a fast car

  2. Tom drives a $strA car.
  3. Tom drives a “fast” car.

  4. none of the above

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

PowerShell single quotes treat everything literally - $strA is not expanded but treated as the literal string '$strA'. Double quotes would expand variables. The output is exactly 'Tom drives a $strA car.' with the variable name displayed, not its value 'fast'.

Multiple choice technology testing
  1. It is a defect

  2. It is a defect which requires more information

  3. It is a defect which will be fixed later during the course of the project

  4. It is not a defect

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

A deferred defect is a confirmed defect that is intentionally postponed for fixing until a later time during the project lifecycle. This typically happens due to factors like project deadlines, risk assessment, or resource allocation. The defect is documented and tracked but not immediately addressed. Option A is incomplete - deferred defects are defects, but the definition misses the key temporal aspect. Option B describes a defect needing clarification, while option D incorrectly denies it's a defect.

Multiple choice technology testing
  1. It is a defect

  2. It is a defect which requires more information

  3. It is a defect which will be fixed later during the course of the project

  4. It is not a defect

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

A deferred defect is a confirmed defect that is documented but intentionally not fixed immediately - it will be addressed later in the project. This might happen due to time constraints, low priority, or plans to fix it during a later phase. Option A is technically true but too vague. Option B describes a defect needing clarification, not deferral. Option D is incorrect - it IS a defect, just postponed.

Multiple choice technology web technology
  1. A method

  2. A function

  3. A statement

  4. An operator

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

void is a JavaScript operator that evaluates an expression and returns undefined. It's commonly used to prevent expressions from returning a value (like void 0 for undefined). It's not a method (A), function (B), or statement (C).

Multiple choice technology web 2.0
  1. create myFunction()

  2. function myFunction()

  3. new_function myFunction()

  4. calling_funtion myFunction()

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

PHP functions are declared using the 'function' keyword followed by the function name and parentheses. Option A is missing the function keyword, options C and D use incorrect syntax that doesn't exist in PHP.

Multiple choice technology programming languages
  1. they can be sorted by type

  2. they can be called at runtime

  3. name functions does not exist

  4. they can be sorted by value

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

The name function in controls allows them to be called at runtime. Name functions do exist in programming contexts, and while controls can be sorted, that's not the primary purpose of the name function.

Multiple choice technology programming languages
  1. Different names

  2. Same name

  3. Both 1 and 2

  4. None of these

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

A control array in Visual Basic is a collection of controls that share the same name, allowing them to be accessed and manipulated as a group. Option B is correct - control arrays have the same name with different index values. Options A, C, and D are incorrect - controls in an array cannot have different names, and this is not an either/or situation.