Jpr - Qb Chapter 02

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Jpr - Qb Chapter 02 as PDF for free.

More details

  • Words: 800
  • Pages: 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. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21.

22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36.

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

37. 38. 39. 40.

List and explain the methods related to size of the vector. Differentiate between String and StringBuffer. Explain the applications of using command line arguments. 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-

Related Documents

Jpr - Qb Chapter 02
June 2020 11
Jpr - Qb Chapter 05
June 2020 3
Jpr - Qb Chapter 06
June 2020 5
Jpr - Qb Chapter 01
June 2020 7
Jpr - Qb Chapter 04
June 2020 7
Jpr - Qb Chapter 03
June 2020 10