You are on page 1of 6
yultiple Choice Questions (b) class and package 1, The keyword to create a class is o class, subclass and package Mg) Class (b) CLASS lies Fy as (@) None + The default access specifier for a method of a class 1. Which of the following is not a feature of OOPS i, se (a) Inheritance (a) Private (b) Public (b) Function Overloading (©) Protected (d) Package fa) Poljaibephise 13. Akash wants the members ofhis class “Employee” (a) All are OOPS Features tobe accessible only tohis class “Employee”, what a Scneisinanests access specifier he should use for the members (@) Binding of all functions together (a) Private (b) Public (b) Adding a function to a class (c) Protected (d) default fod Deisting etmetiod from siclass 14, A bundle of similar classes is called a (4) None of the above (a) Package (b) Group 4, A dlass is an object factory (0) Pace a (@) True (b) False 15. Code reuse is implemented by : 5, Anon static method is also called : 6 ae Pe ecaeitic (b) Function overloading (©) Inheritance (b) Instance method (©) Constant method (d) Instance variable (4) Polymorphism 16. Which of the following are not keywords? ; (a) NULL (b) Implements 6. “One thing in many different forms “ goes with (protected (@ Nason the OOPS concept 17. Which of the following statements are true? (a) Polymorphism —_(b) Inheritance (a) An abstract class may not have any final (©) Encapsulation (d)_ Abstraction aogesen 7. Data hiding is implemented by (b) A final class may not have any abstracts (a) Access specifiers (b) Static variables sorta (©) Inheritance (d) None (©) Transient variables must be static. 8. A static method is also called a: (a) All of the above (@) Instance function (b) Defined function 18, Which of the following methods belong to the (©) Class method (d)_ Fixed function String class? 9. The concept of Abstraction is (a) length’) io eres (a) Binding data and functions together (©) substring) ( 4 ymplexit P 19, What do you mean by nameless objects? object created by using the new keyword. 21. Data type whose size is fixed are called data type (a) primitive (©) non (©) explicit (@) fixed 22, What is known as an object factory? (a) instance () class (© data (@) function From Question 23-27 find the odd one out: 23. (a) Encapsulation _(b) Abstraction (© DataHiding —(d) int 24, (a) Inheritance (©) Reusability (©) Base class and Sub class (A) private 25, (a) private (©) default 26. (a) Data mebers (©) Properties 27, (a) Polymorphism (b) One thing in many forms (©) Abstraction (d) Function overloading 28, A private member of a class can be accessed only inside the class imitive (b) Cops (4) public (b) Characteristics (d) Functions (a) True (b) False 29. The default access specifier for a class member is public (@) True (b) False The OOPS concept that indicates data hiding is Polymorphism (a) True (b) False 31. Default access specifier means package access 35. A static data member of a class is initialized (a) Inside the class (b) Inside a static method (0) just after class definition (d) Inside main( ) method 36. To create an instance method the keyword used (@) Instance (b) Static (©) Non static (d) Nokeyword requis 37, Static methods are called using (a) Object (b) Class name (©) Any one (d) None 38. Seema wants a data member of her class “Produc to be available in all child classes, the acces speci‘ier she should use is__ (a) private (b) protected (©) extends (@) inherits 39. Which statement is true about a class definition (a) Itmust have at least one method (b) Itmust have at least one data member (©) Itmay not have any members 40. Which statement is True : (a) An instance method can access only instance. variables (b) An instance methud can access only static variables (©) Aninstance method can access both staticand non static data members (€) None of the above 41. The keyword that represents the current object is (a) now (b) this (©) current (a) None 42. The attributes or properties of a class. are represented by : (@) Member functions (b) Data members (©) Access specifiers (a) All of them Class variable that is available to the entire class is known as ede n pubic void myMethod { System.out printin("Method”); (2) delete ) obj, (©) User defined data type ' (0) User defined derived data type publi static void main(Stringf] args) ( fresco ne Bit. Static int a= 10; static int n; intb=5; inte; public MyFirst(int m) ( System.out printIn(a + “"4m); +b+ +4", "ent } // Instance Block 1] Static Block static { a= 60; } } (a) 10,5,0, 20,0 () 10,30, 20 (c) 60, 20 (d) 60, 30, 0, 20,0 60. What will be the output of the following program? public class Test { public static void main(String[] args) { int count = 1; while (count < 15) { System.out.println(count % 2—=1?“***” ne); +tcount; } fend while } /Jend main } (@) 15 times “* (b) 15 times +++ (©) 8 times *** and 7 times +++ (d) Both will print only once 61. What will be the output of the following program? public class Test2 { public static void main(String{} args) ( StringBuffer s1 = new StringBuffer(“Complete”); sl.setCharAt(1,''); sl.setCharAt(7,d’); System.o st); appropriate options: class student ( private int admno; private String sname; private float eng, math, science, total 0. private float (a) { float t= eng + math + science; return t } public void (b)___{ { System.out printin(admno); system.out.printin(sname); System.out printin(eng); System.out printin(math); System.out printin( science); System.out,printin(total); ) public void takedata(int a, String n, inte, int m, nt 0) public class stud ( public static void main(String [] args) { student (0) =new student() stdl.takedata(101, “RAM’, 30, 48, 40); std.showdata(); } | (a) (i) getdata (ill) gettotal (ii) showdata (ii) default the members ofa dass are of type default for package which means they are accessible to (c) The binding of data and functions together is called : (i) Inheritance (ii) Both @) and Gi) (e) The default access specifier of members of a class is : (ii) Abstraction (i) Private (iii) Encapsulation (ii) Public (d) Characteristics of a class are also called : (i) Attribute: (iii) Default Tributes

You might also like