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
-
unbinding
-
orthogonality
-
context-free
-
referential transparency
D
Correct answer
Explanation
Referential transparency is a property of expressions in programming where an expression can be replaced by its value without changing the program's behavior.
-
round-off errors.
-
syntax errors.
-
run-time errors.
-
logic errors.
A
Correct answer
Explanation
In numerical computing, performing many operations with floating-point numbers leads to the accumulation of small inaccuracies known as round-off errors. Syntax, run-time, and logic errors are distinct categories of programming mistakes.
-
procedural statements.
-
non procedural statements.
-
both (1) & (2)
-
loop statement.
C
Correct answer
Explanation
Application generators often allow users to define what the program should do (non-procedural) while also providing hooks or extensions for custom logic (procedural), thus combining both.
-
iteration
-
rendezvous statement
-
exception statement
-
all of the above
D
Correct answer
Explanation
Control structures define the flow of execution in a program. Iteration (loops), rendezvous statements (in concurrent programming), and exception handling are all mechanisms used to manage program flow.
-
sequence
-
choice
-
iteration
-
none of the above
C
Correct answer
Explanation
Iteration is the control structure that allows a block of code to be executed repeatedly, forming a loop. Sequence is the default execution order, and choice refers to conditional branching.
-
a machine language program
-
an assembly language program
-
a BASIC program
-
a PASCAL program
D
Correct answer
Explanation
Pascal is a strongly typed language that requires all variables to be declared in a specific declaration block before they are used in the program body. Machine and assembly languages do not have this high-level declaration requirement.
-
mathematical function
-
string function
-
main function
-
recursive function
-
member function
D
Correct answer
Explanation
This function in C++ is a function that calls itself and the process of calling of a function by itself is called recursion.
-
When the inline function definition is too long or too complicated
-
When the inline function is recursive
-
When the inline function has looping constructs
-
When the inline function has a switch or a goto statement
-
When the inline function starts with the keyword 'inline'
E
Correct answer
Explanation
This is a situation where an inline function may work in C++ as an inline function must start with the keyword 'inline'.
-
stdio.h
-
iostream.h
-
stdlib.h
-
iomanip.h
-
math.h
C
Correct answer
Explanation
This header file in C++ is used to declare conversion routines, search/sort routines and other miscellaneous things.
-
internal change
-
inter-module change
-
side effect
-
side-module update
-
an integer
-
a string variable
-
a float
-
none of the above
-
we use * before it in its declaration
-
we use ** before it in its declaration
-
we use *** before it in its declaration
-
all of the above
-
integer
-
number of values which it reads
-
both the above
-
none of the above
-
rev
-
strlwr
-
strlen
-
strev
-
strrev
E
Correct answer
Explanation
“strrev” is the standard library string function which is used to reverse a string.