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
-
bug
-
debug
-
cursor
-
icon
-
None of these
A
Correct answer
Explanation
In computing terminology, an error or flaw in a program is commonly called a 'bug'. Debug is the process of finding and fixing bugs. Cursor is the on-screen indicator, and icon is a graphical symbol.
-
ensures that only the correct data type is entered into a field
-
verifies that all required data is present
-
determines whether a number is within a specified limit
-
tests if the data in two or more associated fields is logical
-
None of these
C
Correct answer
Explanation
A range check validates that entered data falls within specified minimum and maximum boundaries. It's different from type checking (ensures correct data type), completeness check (ensures required fields are filled), or consistency check (ensures logical relationships between fields).
-
executed
-
referenced
-
imported
-
declared
-
None of these
C
Correct answer
Explanation
In Java, packages must be imported using the import statement before they can be used in a program. This makes the classes and interfaces from the package available to your code. Packages don't need to be executed, referenced (too vague), or declared before use - they must be explicitly imported.
-
begin the line with a # sign
-
begin the line with double slashes (/ /)
-
begin and end the line with double hyphens (-_-)
-
indent the line
-
None of these
B
Correct answer
Explanation
C++ uses double forward slashes (//) to indicate single-line comments. Everything after // on that line is treated as a comment and ignored by the compiler. Multi-line comments use /* */ syntax.
-
Define the attribute as required
-
Define subtypes
-
Define each attribute as having an initial value that is recognized as blank
-
Define supertypes
-
None of these
D
Correct answer
Explanation
Supertypes are more general entity types that contain subtypes. Defining supertypes doesn't address null value ambiguities - null ambiguities are typically resolved by defining attributes as required, setting default/initial values, or using subtypes to categorize data more precisely.
-
Public
-
Private
-
Attrlist
-
Name
-
Static
E
Correct answer
Explanation
By using this access modifier, the variables will retain their values, even after the procedure in which these variables are declared.
-
Continue
-
Break
-
Return
-
Boxed
-
Private
B
Correct answer
Explanation
By using this statement, control is passed to the statement that follows the terminated statement.
-
Public
-
Private
-
Name
-
Attrlist
-
Friend
E
Correct answer
Explanation
By using this access modifier, variables are accessible from within the program that contains their declaration as well as from anywhere else in the same assembly.
-
text editor
-
compiler
-
loader
-
debugger
D
Correct answer
Explanation
A debugger is a tool that allows programmers to detect, identify, and fix runtime errors by monitoring program execution flow.
-
information hiding
-
information closing
-
information capsuling
-
none of these
A
Correct answer
Explanation
Information hiding is the principle of concealing implementation details within modules. It reduces complexity and increases modularity by exposing only necessary interfaces.
-
Segment
-
AFTER DROP trigger
-
BEFORE trigger
-
Trigger event
-
Trigger restriction
E
Correct answer
Explanation
This part of the trigger specifies a boolean expression that must be true for the trigger to fire.
A
Correct answer
Explanation
In C and C++, enumerated data types (enums) assign integer values starting from 0 by default. The first enumerator gets value 0, the next gets 1, and so on sequentially. However, programmers can explicitly assign different values if needed. This default behavior makes enums useful for array indexing and creating named constants.
-
Runtime error
-
Compiler error
-
Linker error
-
Syntax error
C
Correct answer
Explanation
The code has a typo: 'void mail()' instead of 'void main()'. This creates a linker error because the linker looks for the main() function as the program entry point but can't find it. The program compiles successfully but fails during linking. This is a common error that occurs when the required main() function is missing or misspelled, preventing the program from being properly linked into an executable.
A
Correct answer
Explanation
The arrow operator (->) is used in C/C++ to access members of a structure or class through a pointer. If ptr is a pointer to a structure, ptr->member is equivalent to (*ptr).member. This is a fundamental pointer operation for structured data.
-
Linker combines the object files into a single executable program.
-
Linker converts the source file into object file.
-
Linker converts the source file into executable file.
-
None of the above
A
Correct answer
Explanation
A linker combines multiple object files (compiled from source code) into a single executable program. It resolves references between modules and performs address binding. Compilers create object files, while linkers create the final executable.