Вы находитесь на странице: 1из 2

Question Bank : Java Programming (9113)

Class : TYIF (IF/V/C)


Chapter No. 02 Classes and Objects

Review Questions from previous MSBTE question papers:

1. Illustrate constructor overloading with example.


2. Give the syntax of class definition.
3. What is constructor? What are its special properties?
4. What are different access control parameters? Explain.
5. Differentiate between ‘this’ and ‘super’.
6. Explain the process of creating object and accessing the members of that
object.
7. Explain the differences between method overriding and overloading.
8. How ‘super’ can be used to call the constructors from other classes?
9. What are different advantages of the class inheritance?
10. What do you think what will be the reason of avoiding multiple inheritance in
Java?
11. How Java implements run-time polymorphism?
12. Enlist different types of inheritance with suitable syntax of creating them.
13. Explain the sequence in which the Java program calls the constructor in a
multilevel hierarchy.
14. Differentiate among different access specifiers in Java
15. What are the differences between abstract class and a final class?
16. How the ‘final’ keyword is useful in inheritance? Explain with suitable example.
17. How to create abstract and final classes?
18. Give the role of public and private specifiers.
19. How the data encapsulation is achieved in the class?
20. Differentiate static and final member variables in the class.
21. Give the syntax and use of following methods.
a. insertElementAt( )
b. compareTo( )
c. equals( )
d. isInfinite( )
22. Give and describe the syntax of any two methods of Integer class.
23. What are the applications of wrapper classes?
24. Differentiate between Vector and Arrays.
25. How many number of ways by which we can concatenate two strings?
26. List constructors of String class.
27. What are different constant values defined by the wrapper classes?
28. Illustrate how to convert a float number to a Float object and vice versa?
29. Explain the methods defined by Character and Boolean class.
30. What do you mean by array of objects?
31. How can we find the number of elements of the array?
32. Give different ways to create an array.
33. Differentiate array of primitive data type and array of objects on the basis of
their creation.
34. Array of objects is created at run time or compile time. Justify your answer.
35. Explain the differences between array of objects and a vector.
36. How to duplicate vector? Illustrate.

-1-
37. List and explain the methods related to size of the vector.
38. Differentiate between String and StringBuffer.
39. Explain the applications of using command line arguments.
40. Enlist various methods used for adding elements inside the vector.

Programming exercises (From String class onwards):

1. Accept an array of 10 floats from user and find the largest number among
them.
2. Input a number from command line and find its binary, octal and hexadecimal
equivalent.
3. Count numbers of vowels in the StringBuffer.
4. Count number of occurrences of any substring inside another string.
5. Accept first name, middle name and surname from keyboard and display the
while in sequence as a single string.
6. Display the string in reverse order.
7. Accept any string containing all types of characters and symbols from user
and count only number of digits.
8. Sort the characters of the string inputted from user.
9. Accept marks and roll no of 10 students from user and display roll number of
student having highest marks.
10. Input a string from user and invert the case of each character of the string.
E.g. Input: “RaJaN” output: “rAjAn”.
11. Define a class ‘student’ having data members roll no and percentage. Accept
this data for ten objects and display the merit list with merit numbers.
12. Create a class ‘item’ containing code and price. Accept this data for five
objects and display this data in reverse order. Also display the total price of all
items.
13. Implement a stack using vector. Implement all basic operations on vector.
14. Implement a queue using vector. Simulate insert and delete operations.
15. Create a menu driven program for vector having following choices:
a. add element
b. delete element
c. display element
d. insert element
e. empty vector
f. count elements
16. Input names from user and store them in a vector. The user may enter any
number of names. Copy this vector in an array of strings and display the
array.
17. Store all the elements inputted from command line into the vector and search
for particular element in the vector.
18. Copy the contents of the vector into a string buffer.
19. Perform multiplication on two different 3 X 3 matrices.
20. Create a method in program as:
delete(String str, int pos)
It will delete the element from position ’pos’ from string ’str’.

-2-

Вам также может понравиться