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
-
NaN
-
null
-
string
-
None of the above
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.
-
Identifies the source of the JCL commands
-
Points to the system software library
-
Marks the beginning of the in-stream JCL
-
Identifies the libraries that the system will search for include groups or procedures named in EXEC statements
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.
-
$global:a = 1
-
$public:a = 1
-
$private:a = 1
-
$local:a = 1
B
Correct answer
Explanation
PowerShell variable scopes are: global, script, local, private, and (for modules) exported. 'public' is NOT a valid scope modifier. Options A, C, D are valid scope declarations.
D
Correct answer
Explanation
In PowerShell, the Trap statement is used to catch and handle terminating errors. It's similar to try/catch in other languages. Catch is used with Try, Throw raises errors, and Get is for retrieval.
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.
-
Variables in the global scope are visible in all scopes
-
Variables in the script scope are visible to all scopes within that script file.
-
Variables in the local scope are visible only in the current scope and not to its children.
-
Private scope variables are visible only to that current scope.
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.
-
\$strComputer = "Computer name" \$colRAM = Get-WmiObject -Class "win32_PhysicalMemory" -namespace "root\CIMV2"-computerName \$strComputer Foreach (\$objRAM In \$colRAM) { "Memory Installed: " + \$objRAM.DeviceLocator &quo
-
\$strComputer = "Computer name" \$colRAM = Get-WmiObject -Class "win32_PhysicalMemoryArray" -namespace "root\CIMV2"-computerName \$strComputer Foreach (\$objRAM In \$colRAM) { "Memory Installed: " + \$objRAM.DeviceLocator
-
\$strComputer = "Computer name" \$colRAM = Get-WmiObject -Class "win32_PhysicalMemorySize" -namespace "root\CIMV2"-computerName \$strComputer Foreach (\$objRAM In \$colRAM) { "Memory Installed: " + \$objRAM.DeviceLocator
-
None of the above
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.
-
Mandatory
-
Named
-
Generic
-
Positional
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.
-
Tom drives a fast car
-
Tom drives a $strA car.
-
Tom drives a “fast” car.
-
none of the above
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'.
-
Premium domain
-
Non-Premiun domain
-
normal domain
-
None of the above
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.
B
Correct answer
Explanation
Access to premium domains is restricted to specific roles. Not all employees require or are granted this access based on their job responsibilities.
-
Database
-
Cursor
-
Client
-
FileUpLoad
D
Correct answer
Explanation
FileUpLoad is a client-side JavaScript object used in HTML forms for file uploads. Database and Cursor are server-side database concepts. Client isn't a standard JavaScript object.
-
A method
-
A function
-
A statement
-
An operator
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).
-
create myFunction()
-
function myFunction()
-
new_function myFunction()
-
calling_funtion myFunction()
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.
-
arguments.length
-
Function.caller
-
Function.display
-
Function.arity
D
Correct answer
Explanation
Function.arity returns the number of arguments expected by a function. Option A's arguments.length returns the actual number of arguments passed, not expected. Options B and C are non-existent properties.