Technology Questions
Practice Technology MCQs with answers and explanations. Page 52 of 79.
Category
Interview
Topic
Technology
Page
52 / 79
Mode
Practice
Questions
Open any question to view the answer and explanation.
In the following C++ program, what is printed by cout when the array name is passed directly to the output stream?
#include <iostream>
using namespace std;
int main() {
int arr[] = {4, 5, 6, 7};
int *p = (arr + 1);
cout << arr;
return 0;
}
Open
View answer
Consider the following C++ program involving a structure and pointer:
#include <iostream>
using namespace std;
struct sec {
int a;
char b;
};
int main() {
struct sec s = {25, 50};
struct sec *ps = (struct sec *)&s;
cout << ps->a << ps->b;
return 0;
}
What is the output of this program when it is run?
Open
View answer
In the following C++ program, what value of x is printed after the function call?
#include <iostream>
using namespace std;
void fun(int x, int y) {
x = 20;
y = 10;
}
int main() {
int x = 10;
fun(x, x);
cout << x;
return 0;
}
Open
View answer
In C++, what is a function prototype and why is it important when declaring and using functions in a program?
Open
View answer
In C++, how would you define a structure, and what is its primary purpose as a user defined data type?
Open
View answer
In C++, what is a reference variable and how does it relate to the original variable it is bound to?
Open
View answer
In modern C++, how many commonly used ways are there to initialize an int variable with a constant value, and what do they conceptually represent?
Open
View answer
In C++, what is an explicit constructor and why would you mark a constructor with the explicit keyword?
Open
View answer
In C++ object oriented design, how many primary techniques are commonly discussed for reusing existing classes in a class hierarchy, such as inheritance and composition or aggregation?
Open
View answer
In C++ exception handling, what is meant by an exception specification on a function declaration or definition?
Open
View answer
In C++ exception handling, which operator or syntax is used to declare a catch all handler that can catch any type of exception?
Open
View answer
In C++, to what kind of class can you apply Run Time Type Information (RTTI) features such as dynamic_cast and typeid, in order to identify the actual derived type at run time?
Open
View answer
In the C++ Standard Template Library (STL), what do vector containers conceptually represent?
Open
View answer
When designing a new container type that works well with the C++ Standard Template Library algorithms, what is the most important component that must be provided?
Open
View answer
In C++, what does the one definition rule (ODR) state about how many definitions of an entity such as a function or class may exist in a program?
Open
View answer
In C++, what is a key advantage of using friend classes, and how do they affect access control between related classes?
Open
View answer
In data structures, what is a stack and which of the following scenarios best illustrates a typical use case for a stack in C++ programs?
Open
View answer
In C++, what is the Standard Template Library (STL), and what main components does it provide to support generic programming?
Open
View answer
In Java programming, what is a wrapper class and why is it used to wrap primitive data types as objects?
Open
View answer
In exception handling, what is stack unwinding and how does it work when an error is thrown at runtime?
Open
View answer
Practice smarter
Solve a few questions daily and revisit weak topics regularly to improve accuracy.