The document contains a series of practice questions related to Java programming concepts, including definitions of key terms like Class, Object, and Inheritance, as well as explanations of various programming methods and algorithms. It also includes questions on Java access specifiers, wrapper classes, and array properties, along with fill-in-the-blank and multiple-choice questions. Additionally, the document provides practical coding exercises and true/false statements to test understanding of Java fundamentals.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
7 views5 pages
Section A Practice Questions 2
The document contains a series of practice questions related to Java programming concepts, including definitions of key terms like Class, Object, and Inheritance, as well as explanations of various programming methods and algorithms. It also includes questions on Java access specifiers, wrapper classes, and array properties, along with fill-in-the-blank and multiple-choice questions. Additionally, the document provides practical coding exercises and true/false statements to test understanding of Java fundamentals.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5
SECTION A PRACTICE QUESTIONS
Q1) Define the following terms and explain them briefly :
Class,Object,Abstraction,Inheritance,Polymorphism,Encapsulation,Method,Con struction,Sor ting,Selection sort,Bubble sort,Linear Search,Binary Search,Array. Q2)Explain the concept of “Fall Through” and Method Overloading,Constructor Overloading. Q3)Differenciate between the following terms : User defined method and System defined method Method and Constructor Linear Search and Binary Search Selection Sort and Bubble sort == and = Logical OR,Logical AND and Logical NOT Syntax error and Logical error Pure method and Impure method Autoboxing and Autounboxing (Unboxing) Actual parameter and Formal parameter Single dimensional array and 2D array Keyword and Variable Call by value and Call by reference Superclass and Subclass EqualsTo and == Nested For and Nested Switch Prefix Increment and Postfix Increment Q4)Explain the meaning of a return statement,dot operator,final keyword and assignment operator Q5)Explain the public,private and protected access specifiers. Q6)What is a Java Package?Explain. #Prediction : Selection Sort and Bubble Sort! Q7) Solve the following a)____Is the return datatype or the endWith() function. b)String1="ICSE COMMUNITY"; System.out.println(String1.length()); c) "MISSISSIPPI".indexOf('5')+"MISSISIPPI".lastindexOf(T); d) "CABLE".compareTo("CADET"); e)String x[ ]=["SAMSUNG", "NOKIA", "SONY", "MICROMAX", "BLACKBERRY"); a) System.out.println(x[1]); b)System.out.prntin(x[3].length);
Q8)Give the Output For the following
a) If a = 97; System.out.println(byte)a; System.out.println((char)a); System.out.println((float)a); b)char ch=65;char ch1='3'; System.out.println(Character.isLetter(ch)); System.out.println(Character.isLetter(ch1)); System.out.println(Character.isLetter('y')); System.out.println(Character.isLetter('8')); System.out.println(Character.isLetter('C')); c)int i=10; long l=1234L; float f =12.45; double d=0.123456D; str1=Integer.toString(i); str2=Float.toString(f); str3=Long.toString(l); str4=Double.toString(d); System.out.println("Str1="+str1+" "+"Str2="+str2); System.out.println("Str3="+str3+" "+"Str4="+str4);
Q9) Solve the following
State true or false 1)Java source code should always have the .jav extension 2)Instance variables are used to represent behaviour of an object. 3)The access specifier private allows accessibility of a member only within the class where the member is declared/defined, but not outside the class 4) A class is used to implement encapsulation 5)You need to prefix the keyword default before data members which should have default/friendly access specifier. Q) What is a wrapper class? Give few examples of wrapper classes. Q)What are access specifiers? FILL IN THE BLANKS: 1) The ______________ access specifier is not allowed for a class. 2)The ______________ keyword is used to perform inheritance in Java 3)The keyword used to include a class in a package is ___________. MCQs 1)Which among the following allows global accessibility? a) public b) private c) protected d) All of these 2)Which among the following allows accessibility only within the class where the member is defined or declared? a) public b) private c) protected d) All of these 3). In case, a source code has multiple classes; the class from which the program begins should have the ________________ access specifier. a) public b) private c) protected d) All of these 4)Which among the following is true, if a constructor is declared as private for a class? a) Another class may declare the object of that class. b) An object may be declared only within that class. c) An object may be declared in a different package. d) None of these. 5) Which among the following is not true for inheritance? a) The class which is being inherited is called the super-class and the class that inherits it is called the sub-class. b) The extends keyword is used to perform inheritance. c) private members of a super-class is also inherited in the sub-class. d) The member functions of a super-class can manipulate the values of the data members of a sub class. 6)Which operator is used to access individual subpackages and classes in a package? a) + operator b) new operator c) this operator d) dot operator 7)Which operator is used to import all classes within a package? a) * b) all c) + d) None of these 8)Which among the following access specifiers allows accessibility outside that package? a) public and private b) public and protected c) public and default d) private and protected.
Q10)Explain the concept of Streams in Java.
Q11) How do you declare single or 2-dimensional arrays? Q12) How do you initialize single dimensional arrays. Explain with examples. Q13)What are properties of arrays? Q14). "Array variables are references to a block of elements". What do you understand by this statement? Q15)How do you determine the length of an array? Q16)State two advantages and disadvantages of using arrays. Q17) Name the keyword that is used for allocating memory to an array Q18)Function of new keyword?