Computer Knowledge
Programming Fundamentals
2,611 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
-
x+7=x
-
x+=7
-
x+x=7
-
None of these
B
Correct answer
Explanation
This is the correct use of short hand operator to increment the variable on the left-hand side with some particular value.
-
Case statement
-
Default statement
-
Break statement
-
None of these
B
Correct answer
Explanation
The default statement is optional and, if it is missing or not present, no action takes place if all matches fail.
-
initialization
-
update
-
test
-
none of these
C
Correct answer
Explanation
The test expression is an expression whose truth value decides whether the loop-body will be executed or not.
-
Derived data type
-
Array
-
Enumeration
-
None of these
C
Correct answer
Explanation
Enumeration data type associates integer constants to names.
-
Global variable
-
Reference variable
-
Local variable
-
Static variable
B
Correct answer
Explanation
Reference variable is used in C++ to assign alternate name or alias to existing variable.
C
Correct answer
Explanation
This operator cannot be overloaded in C++ to perform any additional function.
-
#define statement
-
const statement
-
enum
-
none of these
A
Correct answer
Explanation
This statement is used to declare pre-processor constant statement in C++.
-
If-else statement
-
Switch statement
-
While statement
-
None of these
C
Correct answer
Explanation
This is the looping structure in C++ which excecutes its body until the condition specified in the while statement becomes false.
-
Local scope
-
Function scope
-
Class scope
-
None of these
B
Correct answer
Explanation
Function scope is the scope of variable declared in outermost block of a function.
-
Both are same
-
Both allow to exit from the loop
-
One allows to exit from the loop and another skips the iteration
-
None of these
C
Correct answer
Explanation
'Break' statement is used to exit from the loop statement in the program whereas 'Continue' is used to skip the specified iteration from the loop statement.
-
iostream.h
-
ctype.h
-
string.h
-
iomanip.h
B
Correct answer
Explanation
This header file is included to perform character functions like isalnum(), isdigit(), islower() etc. in the program.
-
Define
-
Pragma
-
Token parsing (##)
-
Both (1) and (3)
-
None of the above
A
Correct answer
Explanation
It is used to ensure that whether a certain name is defined as a macro
-
Member access operator (.)
-
-> operator
-
= operator
-
! opearator
-
None of the above
A
Correct answer
Explanation
This operator is used to access the structure members.
-
Structure is the user defined data type .
-
Structures are used to combine different data elements.
-
Structures are used to represent the records.
-
We can define pointer to structures.
-
None of the above
E
Correct answer
Explanation
All of the above are true statements.
-
A restrict pointer ensures the only means by which the object it points to can be accessed.
-
It ensures that the variable's value may be changed in ways not explicitly specified by the program.
-
It ensures that we can not change objects of type const during program execution.
-
It is not defined in C++.
-
None of the above
A
Correct answer
Explanation
This is a true statement about 'restrict' type qualifiers in C++.