FLEXTRONICS Previous Years Solved Sample Placement Papers
-
What does your class can hold?
(A) Data
(B) Functions
(C) Both A & B
(D) None of the mentioned
Ans: (C)EXPLANATION: The classes in C++ are used to manipulate both data and functions.
-
Which is used to define the member of a class externally?
(A) :
(B) ::
(C) #
(D) None of the mentioned
Ans: (B) -
Which other keywords are also used to declare the class other than class?
(A) struct
(B) union
(C) object
(D) Both A & B
Ans: (D) -
What is the output of the following program?
#include <iostream> using namespace std; class rect { int x, y; public: void val (int, int); int area () { return (x * y); } }; void rect::val (int a, int b) { x = a; y = b; } int main () { rect rect; rect.val (3, 4); cout << "rect area: " << rect.area(); return 0; }
(A) rect area: 1
(B) rect area: 12
(C) rect area: 24
(D) None of the mentioned
Ans: (B) -
Which of the following is a valid class declaration?
(A) class A { int x; };
(B) class B { }
(C) public class A { }
(D) object A { int x; };
Ans: (A) -
The fields in the class in C++ program are by default
(A) Protected
(B) Private
(C) Public
(D) None of the mentioned
Ans: (B) -
Constructors are used to
(A) Initialize the objects
(B) Construct the data members
(C) Both A & B
(D) None of the mentioned
Ans: (A) -
When struct is used instead of the keyword class, what will happen in the program?
(A) Access is public by default
(B) Access is private by default
(C) Access is protected by default
(D) None of the mentioned
Ans: (A)