Computer Knowledge

Programming Fundamentals

2,381 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 web technology
  1. NaN

  2. null

  3. string

  4. None of the above

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

The first typeof evaluates the type of null, which is "object". Applying typeof again to that string yields "string". Hence the final result is the string "string", which is correctly marked as the true option. The other choices do not match the double‑typeof evaluation.

Multiple choice technology mainframe
  1. Identifies the source of the JCL commands

  2. Points to the system software library

  3. Marks the beginning of the in-stream JCL

  4. Identifies the libraries that the system will search for include groups or procedures named in EXEC statements

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

The //JCLLIB statement specifies the private libraries (partitioned data sets) that the z/OS system searches to locate include groups or cataloged procedures invoked by EXEC statements within the job. It overrides or supplements default system procedure libraries (like SYS1.PROCLIB) for the scope of the job.

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. \$strComputer = "Computer name" \$colRAM = Get-WmiObject -Class "win32_PhysicalMemory" -namespace "root\CIMV2"-computerName \$strComputer Foreach (\$objRAM In \$colRAM) { "Memory Installed: " + \$objRAM.DeviceLocator &quo
  2. \$strComputer = "Computer name" \$colRAM = Get-WmiObject -Class "win32_PhysicalMemoryArray" -namespace "root\CIMV2"-computerName \$strComputer Foreach (\$objRAM In \$colRAM) { "Memory Installed: " + \$objRAM.DeviceLocator
  3. \$strComputer = "Computer name" \$colRAM = Get-WmiObject -Class "win32_PhysicalMemorySize" -namespace "root\CIMV2"-computerName \$strComputer Foreach (\$objRAM In \$colRAM) { "Memory Installed: " + \$objRAM.DeviceLocator
  4. None of the above

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

The Win32_PhysicalMemory WMI class provides information about each physical memory module installed in the system. The DeviceLocator property identifies the memory slot location, and the Capacity property indicates the RAM size. Option B uses Win32_PhysicalMemoryArray which describes the memory array hardware rather than individual modules, while Option C references a non-existent WMI class.

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
  1. Premium domain

  2. Non-Premiun domain

  3. normal domain

  4. None of the above

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

DEN is classified as a Premium domain within the organizational domain structure. Premium domains typically have enhanced features, higher service levels, or special security requirements compared to standard domains. The classification affects access protocols and support procedures.

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.