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
-
Iomanip.h
-
Iostream.h
-
Math.h
-
Fstream.h
A
Correct answer
Explanation
This header file is required to make use of manipulators like setw() and endl().
-
Seekp()
-
Tellg()
-
Seekg()
-
Tellp()
C
Correct answer
Explanation
Seekg() function allows the movement of get pointer to a specified location in the file.
-
The element number in array plays a major role in calling each element of the array.
-
Execution time with a pointer is little slow.
-
An external variable is declared outside the body of a function.
-
Both 1 and 3.
-
None of these
-
Brake
-
Extern
-
Const
-
Both 1 and 3
-
None of these
A
Correct answer
Explanation
Brake is not a valid C keyword.
-
Strpbrk ();
-
Strbrk ();
-
Strtok ();
-
Strncmp ();
-
Strstr ();
B
Correct answer
Explanation
Strbrk() is not a standard string function.
-
The element number in array plays a major role in calling each element of array.
-
The execution time with pointer is slower.
-
An external variable is declared outside the body of a function.
-
Both 2 and 3
-
None of these
B
Correct answer
Explanation
The execution time with pointers is very fast.
-
end if
-
else if
-
else
-
fi
-
end
D
Correct answer
Explanation
Whenever an 'if' statement is used in Linux, it must be closed using the reverse of 'if', 'fi'.
-
print
-
read
-
echo
-
Input
-
Get
B
Correct answer
Explanation
The read statement is used to get input from keyboard and store it to a variable.
-
The name of a variable can start with an underscore.
-
Variable names are case sensitive.
-
Variable names must be unique.
-
Variable declaration must start with the $ sign.
-
Variable names can contain '?'.
E
Correct answer
Explanation
The name of a variable cannot contain '?'. The only allowed symbol is underscore ( _ )
-
Function Call
-
Function Declaration
-
Function Definition
-
Multiple call to function
B
Correct answer
Explanation
In this part, we can specify default arguments for which values can be specified or not at the time of calling the function.
-
Call by value
-
Function overloading
-
Call by reference
-
Inline functions
C
Correct answer
Explanation
In this method, the original copy of the variable is used by the function. Hence, any changes made to the variables are reflected in the main program.
-
goes out of scope
-
expires
-
both (1) and (2)
-
none of the above
C
Correct answer
Explanation
The destructor is automatically called when an object either goes out of scope or reaches the end of its lifetime (expires). Both scenarios trigger the destructor to clean up resources.
-
+=
-
=
-
= =
-
All of the above
D
Correct answer
Explanation
In C++, the +=, =, and == operators can all be overloaded. The += operator can be overloaded as a compound assignment operator, while = and == can be overloaded as member or non-member functions.
-
Cout.prec()
-
Cout.precision
-
Cout.Precision
-
None of the above
-
data is secure
-
data is insecure
-
data is abstract
-
none of the above