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
-
data in a file
-
stderr
-
string
-
stdin
-
stdout
C
Correct answer
Explanation
The function sprintf() operates on strings.
-
Auto
-
Register
-
Static
-
Extern
-
Intern
C
Correct answer
Explanation
The static storage class instructs the compiler to keep a local variable in existence during the lifetime of the program instead of creating and destroying it each time it comes into and goes out of scope. Therefore, making local variables static allows them to maintain their values between function calls.
-
Preprocessor commands
-
Functions
-
Variables
-
Statements and expressions
-
Comments
E
Correct answer
Explanation
Comments are program documentations, which help the reader to understand the code better.
-
Compile-time errors
-
Run-time errors
-
Logical errors
-
None of these
B
Correct answer
Explanation
These are the errors that occur during execution of a program.
-
Imperative statement
-
Declaration statement
-
Assembler directive
-
None of these
A
Correct answer
Explanation
The imperative statement indicates an action to be performed during the execution of the assembled program.
-
endl
-
const
-
malloc()
-
none of these
A
Correct answer
Explanation
It is a manipulator used to perform line feed in the program. It can be used by including the header file iomanip.h in the beginning of the program.
-
For loop
-
Do-while loop
-
While loop
-
None of these
B
Correct answer
Explanation
This is an exit-controlled loop statement in which the loop statement is executed at least once, even if the condition is false.
-
'<'
-
'?:'
-
'>'
-
None of these
B
Correct answer
Explanation
This operator cannot be overloaded in C++ to perform any additional function.
-
Inline function
-
Operator function
-
Virtual function
-
None of these
B
Correct answer
Explanation
This is a special function used to perform operator overloading in C++.
-
Dynamic binding
-
Late binding
-
Static binding
-
None of these
C
Correct answer
Explanation
This is the property of C++ that bounds functions to the code to be executed at compile time.
-
typeid
-
typedef
-
typename
-
none of these
B
Correct answer
Explanation
This code is used to give a new name to an existing data type in C++.
-
initialization
-
test
-
update
-
none of these
B
Correct answer
Explanation
This expression is used in loop statement to test the condition and if this statement is omitted, it can lead to infinity condition in the loop.
-
eof()
-
fail()
-
bad()
-
none of these
B
Correct answer
Explanation
This function returns true when an input or output operation has failed.
-
break
-
exit()
-
go to
-
none of these
B
Correct answer
Explanation
This function is used in C++ to break out of the program abondoning the rest of the execution of the program.
-
width()
-
precision()
-
setf()
-
none of these
C
Correct answer
Explanation
This function specifies format flags that can control the form of output display.