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
-
an operator
-
a label
-
a variable
-
a function
B
Correct answer
Explanation
The goto statement transfers control to a labeled statement within the same function. You use goto with a label like 'my_label:' and then 'goto my_label;' to jump to that point. Option B correctly states that goto causes control to go to 'a label'. It cannot jump to operators (A), variables (C), or functions (D) - only to labeled statements within the current function.
-
the loop in which it occurs
-
the block in which it occurs
-
the function in which it occurs
-
the program in which it occurs
D
Correct answer
Explanation
The exit() function in C++ terminates the entire program immediately, not just the current function or loop. It performs cleanup and ends program execution. Option D correctly states it causes exit from 'the program in which it occurs'. This is different from return, which only exits from the current function. The exit() function is defined in header and affects the whole program.
-
Form layout window
-
Properties window
-
Form window
-
Project window
-
Main window
D
Correct answer
Explanation
Project window displays a list of all forms and modules for making an application in visual basic.
-
If-else statements
-
Looping statements
-
For/Next statement
-
GoTo Label statement
-
Select Case statement
A
Correct answer
Explanation
If-else branching statements are used to cause certain actions within a program if a certain condition is met.
-
Appearance
-
Activate
-
Cls
-
Enabled
-
Print
B
Correct answer
Explanation
This is a form event which is triggered when form becomes the active window.
-
a window which is used to write a visual basic code for an application
-
a small screen which is used to reposition the form of the application, so that it appears in proper place when project is run
-
a window used for each form to customise the designed interface of the application
-
a window which contains list of the forms and modules for the current projects
-
a window which display list of properties settings for a selected form or a control
C
Correct answer
Explanation
This window is called Form Designer Window.
-
Local window
-
Immediate window
-
Call stack window
-
Code window
-
Form layout window
C
Correct answer
Explanation
Call stack window is useful as a debugging tool.
-
About Dialog form template
-
Tip of the Day form template
-
Splash screen
-
Login Dialog Form template
-
Options Dialog
A
Correct answer
Explanation
The About Dialog form is used to give some information to the user.
-
IF-ELSE
-
DO-WHILE
-
FOR-NEXT
-
WHILE
A
Correct answer
Explanation
IF-ELSE is a conditional branching structure that executes different code blocks based on a condition. It does not repeat code execution. DO-WHILE, FOR-NEXT, and WHILE are all looping constructs that repeatedly execute code blocks.
-
Domain
-
Code
-
User info
-
Application specific information
-
Implemented code
E
Correct answer
Explanation
NSError object does not have implemented code.
-
The local variable is overwritten.
-
A function pointer is overwritten.
-
A parameter of a different stack frame is overwritten.
-
It occurs in the heap data area and is exploitable in a manner different from that of stack-based overflows.
-
The execution will resume at the return address as specified by the attacker, usually a user-input filled buffer.
-
It prevents execution of code on the stack or the heap.
-
An attacker may use buffer overflows to insert arbitrary code into the memory of a program.
-
Some Unix-based systems support executable space protection.
-
This approach uses packet scanning method.
-
Executable space protection does not protect against return-to-libc attacks.
D
Correct answer
Explanation
Executable space protection mechanism does not use packet scanning method.
-
Scope resolution operator
-
Structure reference
-
Ternary condition
-
Size of
-
Addition operator
E
Correct answer
Explanation
Operator overloading is a feature to give new meaning to the existing operator.
-
C++ uses the scope resolution operator to resolve ambiguity between functions.
-
C++ supports function overloading to resolve ambiguity.
-
Each function is unique in C++.
-
C++ does not provide any mechanism to resolve function ambiguity.
-
Both (1) and (2)
-
Unable to open include file iosteam.h
-
Undefined symbol cout
-
Both (1) and (2)
-
The program will compile and execute normally.
-
It will give a warning to the user.
C
Correct answer
Explanation
Both errors are displayed in this program.