JPR - QB Chapter 02
JPR - QB Chapter 02
-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.
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-