FLEXTRONICS Previous Years Solved Sample Placement Papers
-
Where is the object created?
(A) Class
(B) Constructor
(C) Destructor
(D) Attributes
Ans: (B) -
How to access the object in the class?
(A) Scope resolution operator
(B) Ternary operator
(C) Direct member access operator
(D) None of the mentioned
Ans: (C) -
Which of these following members are not accessed by using direct member access operator?
(A) Public
(B) Private
(C) Protected
(D) Both b & c
Ans: (D) -
What is the output of the following program?
#include <iostream> using namespace std; class Box { public: double length, breadth, height; }; int main() { Box Box1; double volume; Box1.height = 5; Box1.length = 6; Box1.breadth = 7.1; volume = Box1.height * Box1.length * Box1.breadth; cout << "Volume of Box1 : " << volume << endl; return 0; }
(A) 210
(B) 213
(C) 215
(D) 217
Ans: (B) -
Pick out the other definition of objects.
(A) Member of the class
(B) Associate of the class
(C) Attribute of the class
(D) Instance of the class
Ans: (D) -
How many objects can present in a single class?
(A) 1
(B) 2
(C) 3
(D) As many as possible
Ans: (D) -
What is the output of this program?
#include <iostream> using namespace std; class sample { private: int var; public: void input() { cout << var; } void output() { cout << "Variable entered is "; cout << var << "\n"; } }; int main() { sample object; object.input(); object.output(); object.var(); return 0; }
(A) Enter an integer 5 Variable entered is 5
(B) Runtime error
(C) Error
(D) None of the mentioned
Ans: (C) -
Which special character is used to mark the end of a class?
(A) ;
(B) :
(C) #
(D) $
Ans: (A) -
What is the output of this program?
#include <iostream> using namespace std; class number { int i; public: int geti(); void puti(int j); }; int number::geti() { return i; } void number::puti(int j) { i = j; } int main() { number s; s.puti(10); cout << s.geti(); return 0; }
(A) 10
(B) 11
(C) 20
(D) 22
Ans: (A)