LG Previous Years Solved Sample Placement Papers
-
Which of the following problem causes an exception?
A: Missing semicolon in statement in
main()
.B: A problem in calling function
C: A syntax error
D: A run-time error
Ans: D -
Which one of the following options is correct about the statement given below? The compiler checks the type of reference in the object and not the type of object.
A: Inheritance
B: Polymorphism
C: Abstraction
D: Encapsulation
Ans: B -
What will be the output of the following program?
#include <iostream.h> void main() { float x; x = (float)9/2; cout << x; }
A: 4.5
B: 4.0
C: 4
D: 5
Ans: A -
The term __________ means the ability to take many forms.
A: Inheritance
B: Polymorphism
C: Member function
D: Encapsulation
Ans: B -
Runtime polymorphism is achieved by
A: Friend function
B: Virtual function
C: Operator overloading
D: Function overloading
Ans: B -
Access to private data
A: Restricted to methods of the same class
B: Restricted to methods of other classes
C: Available to methods of the same class and other classes
D: Not an issue because the program will not compile
Ans: B -
Additional information sent when an exception is thrown may be placed in
A: The throw keyword
B: The function that caused the error
C: The catch block
D: An object of the exception class
Ans: C -
What is the output of the following code
char symbol[3] = {'a', 'b', 'c'}; for (int index = 0; index < 3; index++) cout << symbol[index];
A: a b c
B: "abc"
C: abc
D: 'abc'
Ans: C -
Identify the operator that is NOT used with pointers
A: ->
B: &
C: *
D: >>
Ans: D -
Overloading a postfix increment operator by means of a member function takes
A: No argument
B: One argument
C: Two arguments
D: Three arguments
Ans: A -
Which of the following is not the characteristic of constructor?
A: They should be declared in the public section.
B: They do not have return type.
C: They cannot be inherited.
D: They can be virtual.
Ans: D -
You separated a derived class name from its access specifier with
A: A colon
B: Two colons
C: At least one space
D: A semi colon
Ans: B -
The members of a class by default are
A: Public
B: Protected
C: Private
D: Mandatory to specify
Ans: C -
The type of value that a function sends back to the function that calls it is known as its _____
A: type
B: return value
C: reference data
D: sentinel
Ans: B -
Which of the following are never inherited?
A: public data members
B: constructor functions
C: void functions
D: overloaded + operators
Ans: B -
A function's purpose is to print customer data. Which of the following is the best name for this function?
A: pcd(). It's short for "print customer data" and takes few keystrokes
B: Printcustomerdata(). It states everything the function will do
C: printCustomer(). It states the function's purpose and is easy to read
D: lastFunction(). It is the final function called in most programs, and this name identifies the function's timing
Ans: C -
The function strcmp("Jose", "JOSE") will return _____
A: -1
B: 0
C: 1
D: null
Ans: C