Professional Documents
Culture Documents
JAVA MID - EXAM PAPER - Wordgoogle Forms
JAVA MID - EXAM PAPER - Wordgoogle Forms
JAVA MID - EXAM PAPER - Wordgoogle Forms
1. Email address *
2. STUDENT NAME *
3. ROLL NO *
4. year *
III
5. SECTION *
III
IV
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 1/34
11/2/2020 JAVA MID- EXAM PAPER
6. 1) Which of the following option leads to the portability and security of Java?
a. Bytecode is executed by JVM
b. The applet makes the Java code secure and portable
a. Dynamic
b. Architecture Neutral
c. Use of pointers
d. Object-oriented
8. 3)What would be the output of the following fraction of code ? int Integer = 34 ;
char String = 'S' ; System.out.print( Integer ) ; System.out.print( String ) ;
a)int Integer = 34 ;
b)34 s
c)System.out.print( Integer ) ;
d)System.out.print( String ) ;
A.Prints 2.5
C. Raises an exception
D. None of these
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 2/34
11/2/2020 JAVA MID- EXAM PAPER
A.float
B. double
C. Compilation Error
A.short to int
B. byte to int
C. int to long
D. long to int
A.Two type are compatible and size of destination type is shorter than source type.
B. Two type are compatible and size of destination type is equal of source type.
C. Two type are compatible and size of destination type is larger than source type.
D. All of the above
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 3/34
11/2/2020 JAVA MID- EXAM PAPER
B. 64 and 64
C. 32 and 32
D. 64 and 32
14. 9)The smallest integer type is ......... and its size is .........
bits..
A.short, 8
B. byte, 8
C. short, 16
D. short, 16
is?
16 bit
B. 32 bit
C. 64 bit
16. 11)In Java byte, short, int and long all of these
are?
A.signed
B. unsigned
D. None of these
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 4/34
11/2/2020 JAVA MID- EXAM PAPER
A.6
B. 7
C. 8
D. 9
weakly typed
B. strongly typed
C. moderate typed
D. None of these
19. 14)Given a method in a protected class, what access modifier do you use to
restrict access to that method to only the other members of the same class?
A.Final
B.Static
C.Private
D.Protected or Volatile
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 5/34
11/2/2020 JAVA MID- EXAM PAPER
20. 15)Which of the following class level (nonlocal) variable declarations will not
compile?
A.protected int a;
B.transient int b = 3;
D.volatile int d;
21. 16)Which two of the following are legal declarations for nonnested classes and
interfaces? 1. final abstract class Test {} 2. public static interface Test {} 3. final
public class Test {} 4. protected abstract class Test {} 5. protected interface Test
{} abstract public class Test {}?
A.1 and 4
B.2 and 5
C.3 and 6
D.4 and 6
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 6/34
11/2/2020 JAVA MID- EXAM PAPER
D)both B and C
24.
25. 20)What is the return type of the hashCode() method in the Object class?
A.a. Object
B.int
C long
D. void
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 7/34
11/2/2020 JAVA MID- EXAM PAPER
26. 21)) Which of the following creates a List of 3 visible items and multiple
selections abled?
A)new List(false, 3)
C)new List(true, 3)
27. 22)Which method of the Class.class is used to determine the name of a class
represented by the class object as a String?
A)getClass()
B) intern()
C)getName()
D)toString()
28. 23)In which process, a local variable has the same name as one of the instance
variables?
A)Serialization
B)Variable Shadowing
C)Abstraction
D)Multi-threading
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 8/34
11/2/2020 JAVA MID- EXAM PAPER
29. 24)Which of the following is true about the anonymous inner class?.
class?.
A)java.util package
B) java.lang package
C) java.awt package
D)java.io package
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 9/34
11/2/2020 JAVA MID- EXAM PAPER
A)Runnable Interface
B)Marker Interface
C)Abstract Interface
D)CharSequence Interface
C)creating objects
D)many forms
l.
35. 30)Which of these classes are the direct subclasses of the Throwable class?
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 10/34
11/2/2020 JAVA MID- EXAM PAPER
37. 32)In which memory a String is stored, when we create a string using new
operator?
A)Stack
B) String memory
C)Heap memory
A)Runnable interface
C)Readable interface
D)Result interface
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 11/34
11/2/2020 JAVA MID- EXAM PAPER
a. object
b. strictfp
c. main
pointer
A)package
B)import
C)extends
D)export
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 12/34
11/2/2020 JAVA MID- EXAM PAPER
for_____..
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 13/34
11/2/2020 JAVA MID- EXAM PAPER
47. 42) What is meant by the classes and objects that dependents on each other?
a. Tight Coupling
b. Cohesion
c. Loose Coupling
d. None of the above
b. Multiple threads
49. 44)If three threads trying to share a single object at the same time, which
condition will arise in this scenario?
.
a. Time-Lapse
b. Critical situation
c. Race condition
d. Recursion
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 14/34
11/2/2020 JAVA MID- EXAM PAPER
50. 45)Which of the following modifiers can be used for a variable so that it can be
accessed by any thread or a part of a program?
a. global
b. transient
c. volatile
d. default
51. 46)Which one of these lists contains only Java programming language
keywords?
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 15/34
11/2/2020 JAVA MID- EXAM PAPER
java?.
A.interface
B.string
C.Float
D.unsigned
54. 49)Which three are legal array declarations? 1. int [] myScores []; 2. char []
myChars; 3. int [6] myScores; 4. Dog myDogs [];5. Dog myDogs [7];
A.1, 2, 4
B.2, 4, 5
C.2, 3, 4
55. 50)Which one of the following will declare an array and initialize it
with five numbers?.
B.int [] a = {23,22,21,20,19};
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 16/34
11/2/2020 JAVA MID- EXAM PAPER
56. 51)Which three are valid declarations of a char?1. char c1 = 064770;2. char c2
= 'face';3. char c3 = 0xbeef;4. char c4 = \u0022;5. char c5 = '\iface';6. char c6 =
'\uface';
1,2,4
1,3,6
3, 5
5 only
boolean?.
A.boolean b1 = 0;
B.boolean b2 = 'false';
C.boolean b3 = false;
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 17/34
11/2/2020 JAVA MID- EXAM PAPER
59. 53)Which three are valid declarations of a float?1. float f1 = -343;2. float f2 =
3.14;3. float f3 = 0x12345;4. float f4 = 42e7;5. float f5 = 2001.0D;6. float f6 =
2.81F;
A.1, 2, 4
B.2, 3, 5
C.1, 3, 6
D.2, 4, 6
B.String s2 = 'null';
A)-128 to 127
B)-(215) to (215) - 1
C)0 to 32767
D)0 to 65535
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 18/34
11/2/2020 JAVA MID- EXAM PAPER
62. 56)What will be the output of the program? class Test { public static void
main(String [] args) { int x=20; String sup = (x < 15) ? "small" : (x < 22)?
"tiny" : "huge"; System.out.println(sup); }}
small
tiny
huge
Compilation fails
A.public
B.private
C.protected
D.transient
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 19/34
11/2/2020 JAVA MID- EXAM PAPER
65. 59)What is the most restrictive access modifier that will allow members of one
class to have access to members of another class in the same package?
A.public
B.abstract
C.protected
D.synchronized/default access
Option 5
67. 61)You want a class to have access to members of another class in the same
package. Which is the most restrictive access that accomplishes this objective?
A.public
B.private
C.protected
D.default access
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 20/34
11/2/2020 JAVA MID- EXAM PAPER
69. 63)Which two of the following are legal declarations for nonnested classes and
interfaces?1. final abstract class Test {}2. public static interface Test {}3. final
public class Test {}4. protected abstract class Test {}5. protected interface Test
{}6. abstract public class Test {}
A.1 and 4
B.2 and 5
C.3 and 6
D.4 and 6
A.public
B.private
C.protected
D.transient
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 21/34
11/2/2020 JAVA MID- EXAM PAPER
71. 65)Which three form part of correct array declarations? 1. public int a [ ]2. static
int [ ] a3. public [ ] int a4. private int a [3]5. private int [3] a [ ]6. public final int [ ] a
A.1, 3, 4
B.2, 4, 5
C.1, 2, 6
D.2, 5, 6
72. 66)What is the most restrictive access modifier that will allow members of one
class to have access to members of another class in the same package?
public
abstract
protected
synchronized/default access
73. 67)You want a class to have access to members of another class in the same
package. Which is the most restrictive access that accomplishes this objective?
public
private
protected
default access
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 22/34
11/2/2020 JAVA MID- EXAM PAPER
74. 68)Which two of the following are legal declarations for nonnested classes and
interfaces?1. final abstract class Test {}2. public static interface Test {}3. final
public class Test {}4. protected abstract class Test {}5. protected interface Test
{}6. abstract public class Test {}
A.1 and 4
B.2 and 5
C.3 and 6
D.4 and 6
75. 69)Which of the following class level (nonlocal) variable declarations will not
compile?
A.protected int a;
B.transient int b = 3;
D.volatile int d;
76. 70)Which two cause a compiler error?1. float[ ] f = new float(3);2. float f2[ ] =
new float[ ];3. float[ ]f1 = new float[3];4. float f3[ ] = new float[3];5. float f5[ ] =
{1.0f, 2.0f, 2.0f};
A.2, 4
B.3, 5
C.4, 5
D.1, 2
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 23/34
11/2/2020 JAVA MID- EXAM PAPER
77. 71)Given a method in a protected class, what access modifier do you use to
restrict access to that method to only the other members of the same class?
final
static
private
protected or volatile
A.1 and 3
B.2 and 4
C.3 and 5
D.4 and 6
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 24/34
11/2/2020 JAVA MID- EXAM PAPER
80. 74)A process that involves recognizing and focusing on the important
characteristics of a situation or object is known as
(a) Encapsulation
(b) Polymorphism
(c) Abstraction
(d) Inheritance
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 25/34
11/2/2020 JAVA MID- EXAM PAPER
(a) Encapsulation
(b) Interface
(c) Composition
(d) Inheritance
84. 78)Which of the following does not belong: If a class inherits from some other
class, it should
(b) Over-ride or add the minimum to accomplish the derived class’ purpose
(d) inheritance does not describe any kind of relationship between classes
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 26/34
11/2/2020 JAVA MID- EXAM PAPER
86. 80)The wrapping up of data and functions into a single unit is called
(a) Encapsulation
(b) Abstraction
(d) Polymorphism
(a) Refers to the ability of two or more objects belonging to different classes to
respond to exactly the same message in different class-specific ways
(d) Refers to the ability of two or more objects belonging to different classes to
respond to exactly the same message in different class-specific ways and simplifies
code maintenance.
(a) Encapsulation
(b) Interface
(c) Composition
(d) Inheritance n 4
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 27/34
11/2/2020 JAVA MID- EXAM PAPER
89. 83)Given a class named student, which of the following is a valid constructor
declaration for the class?
90. 84)What is the error in the following class definitions?Abstract class xy{abstract
sum (int x, int y) { }}
91. 85) Which of these field declarations are legal within the body of an interface?
(a) Private final static int answer = 42 (b) public static int answer=42(c) final
static answer =42 (d) int answer
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 28/34
11/2/2020 JAVA MID- EXAM PAPER
(a) Classes
(b) Interfaces
93. 87) A method within a class is only accessible by classes that are defined within
the same package as the class of the method. Which one of the following is used
to enforce such restriction?
94. 88)Basic Java language functions are stored in which of the following java
package?
(a) java.lang
(b) java.io
(c) java.net
(d) java.util
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 29/34
11/2/2020 JAVA MID- EXAM PAPER
95. 89) Given the code String s1 = ” yes” ;String s2 = ” yes ” ;String s3 = new String
( s1);Which of the following would equate to true?
(a) s1 == s2 .
(b) s1 = s2
(c) s3 == s1
(d) s3=s1
96. 90) Which of the following events will cause a thread to die?
(a)void method1
(b)void method2()
(c)void method3(void)
(d)method4()
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 30/34
11/2/2020 JAVA MID- EXAM PAPER
98. 92) Given a class named Book, which one of these is a valid constructor
declaration for the class?
a)Book(Book b) { }
b)Book Book() { }
a)Private members are always accessible from within the same package
b)Private members can only be accessed by code from within the class of the
member
c)A member with default accessibility can be accessed by any subclass of the
class in which it is defined
100. 94) Which of the following is true about the use of modifiers?
b)You cannot specify accessibility of local variables. They are only accessible
within the block in which they are declared
c)Subclasses of a class must reside in the same package as the class they
extend
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 31/34
11/2/2020 JAVA MID- EXAM PAPER
A)james Gosley
B)Denni's ritche
C)Charles babage
D)babaje
B)group of objects
C)group of classes
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 32/34
11/2/2020 JAVA MID- EXAM PAPER
D)All
106. 98)class is
A)group of objects
C)datatypes
D)packages
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 33/34
11/2/2020 JAVA MID- EXAM PAPER
107. 99)Encapsulation
A)many forms
B)few forms
C)low forms
D)High Forms
Forms
https://docs.google.com/forms/d/1CJiK0mxlPjBxwPHdc8EyWRI9Y31BkzAdrF_aag4zECs/edit 34/34