JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
Object Oriented Programming interview questions part 48
Object Oriented Programming interview questions part 48
Back
Take as many assements as you can to improve your validate your skill rating
Total Questions: 20
1. The compareTo() function is used to ________________
A. Compare strings value to string object
B. Compare string value to string value
C. Compare string object to another string object
D. Compare string object to another string value
Show Correct Answer
Correct Answer is :
Compare string object to another string object
2. String class provides function toUpper() to _____________________
A. Convert first character to uppercase
B. Convert last character to uppercase
C. Convert the whole string characters to uppercase
D. Convert uppercase to lower and lower to uppercases
Show Correct Answer
Correct Answer is :
Convert the whole string characters to uppercase
3. String trim() function is used to _______________________
A. Remove all the white spaces from the string
B. Remove white space from start of string
C. Remove white space at end of string
D. Remove white space from both the ends of string
Show Correct Answer
Correct Answer is :
Remove white space from both the ends of string
4. Function replace() accepts _____________ arguments.
A. 1
B. 2
C. 3
D. 4
Show Correct Answer
Correct Answer is :
2
5. If two arguments are passed to the indexOf() function then ___________________
A. Second argument indicates the occurrence number of specified character from starting
B. Second argument indicates the occurrence number of specified character from end
C. Second argument indicates the index of the character in first argument
D. Second argument indicates the index of the character from the last of the string
Show Correct Answer
Correct Answer is :
Second argument indicates the occurrence number of specified character from starting
6. The string class deals with string of only character type.
A. TRUE
B. FALSE
C.
D.
Show Correct Answer
Correct Answer is :
TRUE
7. A template class can have _____________
A. More than one generic data type
B. Only one generic data type
C. At most two data types
D. Only generic type of integers and not characters
Show Correct Answer
Correct Answer is :
More than one generic data type
8. Which among the following is the proper syntax for the template class?
A. template ;
B. Template ;
C. template T named(T x, T y){ }
D. Template T1 named(T1 x, T2 y){ }
Show Correct Answer
Correct Answer is :
template T named(T x, T y){ }
9. Can default arguments be used with the template class?
A. Yes, in some special cases
B. Yes, always
C. No, it must satisfy some specific conditions first
D. No, it can’t be done
Show Correct Answer
Correct Answer is :
Yes, always
10. What is the syntax to use explicit class specialization?
A. template class myClass{ }
B. template class myClass{ }
C. template class myClass{ }
D. template class myClass{ }
Show Correct Answer
Correct Answer is :
template class myClass{ }
11. Which is the most significant feature that arises by using template classes?
A. Code readability
B. Ease in coding
C. Code reusability
D. Modularity in code
Show Correct Answer
Correct Answer is :
Code reusability
12. A template class defines the form of a class _____________________ it will operate.
A. With full specification of the data on which
B. With full specification of the functions on which
C. Without full specification of the data on which
D. Without full specification of the functions on which
Show Correct Answer
Correct Answer is :
Without full specification of the data on which
13. What are the two specializations of I/O template classes in C++?
A. 16-bit character and wide characters
B. 8-bit character and wide characters
C. 32-bit character and locale characters
D. 64-bit characters and locale characters
Show Correct Answer
Correct Answer is :
8-bit character and wide characters
14. Can typeid() function be used with the object of generic classes?
A. Yes, only if default type is given
B. Yes, always
C. No, generic data can’t be determined
D. No, never possible
Show Correct Answer
Correct Answer is :
Yes, always
15. The _____________ class is a specialization of a more general template class.
A. String
B. Integer
C. Digit
D. Math
Show Correct Answer
Correct Answer is :
String
16. How is function overloading different from template class?
A. Overloading is multiple function doing same operation, Template is multiple function doing different operations
B. Overloading is single function doing different operations, Template is multiple function doing different operations
C. Overloading is multiple function doing similar operation, Template is multiple function doing identical operations
D. Overloading is multiple function doing same operation, Template is same function doing different operations
Show Correct Answer
Correct Answer is :
Overloading is multiple function doing similar operation, Template is multiple function doing identical operations
17. What if static members are declared inside template classes?
A. All instances will share the static variable
B. All instances will have their own static variable
C. All the instances will ignore the static variable
D. Program gives compile time error
Show Correct Answer
Correct Answer is :
All instances will have their own static variable
18. What is the output of following program? template
void test(const T&x) { static int count = 0; cout << "x = " << x << " count = " << count << endl; ++count; return; } void main() { test
(2); test
(2); test
(2.2); }
A. x = 2 count = 0
B. x = 2 count = 0
C. x = 2 count = 0
D. x = 2 count = 0
Show Correct Answer
Correct Answer is :
x = 2 count = 0
19. If template class is defined, is it necessary to use different types of data for each call?
A. No, not necessary
B. No, but at least two types must be there
C. Yes, to make proper use of template
D. Yes, for code efficiency
Show Correct Answer
Correct Answer is :
No, not necessary
20. How many generic types can be given inside a single template class?
A. Only 1
B. Only 3
C. Only 7
D. As many as required
Show Correct Answer
Correct Answer is :
As many as required
Similar Interview Questions
Search for latest jobs
Find Jobs