0% found this document useful (0 votes)
5 views

MCQ Practice Set 1

Copyright
© © All Rights Reserved
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% found this document useful (0 votes)
5 views

MCQ Practice Set 1

Copyright
© © All Rights Reserved
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/ 4

1. OOP encourages ___________.

Data Security
Data Functionality
Method Security
None of these
2. Subclass is also known as _________.
Superclass
Base Class
Target
None of these.
3. A class can have only _________ access specifier.
Private
Public
Protected
All of these
4. Class is a _________ data type.
Primitive
Composite
Singleton
Explicit
5. Determine the type of casting for int a='A’;
implicit
Explicit
Composite
All of these

6. Which of the following option leads to the portability and security of Java?
Bytecode is executed by JVM
Use of exception handling
Dynamic binding between objects
None of these.
7. What will be the output of the following program?
String s1=” “;
String s2=”APPLE”;
int n=s1.compareTo(s2) ;
5
65
0
-65

8. _____ is used to find and fix bugs in the Java programs.


JVM
JRE
JDK
JDB

9. Which of the following is a valid declaration of a char?


char ch = '\utea';
char ca = 'tea';
char cr = \u0223;
char cc = '\itea';

10. Which of the following is a valid long literal?


ABH8097
L990023
904423
0xnf029L
11. What does the expression float a = 35 / 0 return?
Not a Number
Infinity
Run time exception
0
12. Evaluate the following Java expression, if x=3, y=5, and z=10:
++z + y - y + z + x++

24
23
20
25

13. 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 ? "***" : "+++++");
++count;
} } }
15 times ***
15 times +++++
8 times *** and 7 times +++++
Both will print only once
14. Which of the following for loop declaration is not valid?
for ( int i = 99; i >= 0; i / 9 )
for ( int i = 7; i <= 77; i += 7 )
for ( int i = 20; i >= 2; - -i )
for ( int i = 2; i <= 20; i = 2* i )
15. Which of the following is a reserved keyword in Java?
object
strictfp
main
system

16. Which of the following inheritance is not applicable in Java?


Single
Multiple
Multilevel
Hierarchical

17. Which keyword is used for accessing the features of a package?


Export
Import
import
Access

18. What will be the output of the following program?


public class Test2 {
public static void main(String[] args) {
StringBuffer s1 = new StringBuffer("Complete");
s1.setCharAt(1,'i');
s1.setCharAt(7,'d');
System.out.println(s1);
}
}

Complete
Iomplede
Cimpletd
Coipletd
19. Output of Math.rint(18.88) is _______.
19
18
18.00
20

20. Given,
ArrayList list = new ArrayList();
What is the initial quantity of the ArrayList list?

5
10
0
100

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy