Core Java 2020
Core Java 2020
1 we try to write applets, we must make sure that Java is installed properly also ensure that either the java …………….. or
a java-enabled browser is available.
(A) viewer( ) (B) appletviewer( ) (C)appletrunner( ) (D)browserviewer( )
2 Which of these functions is called to display the output of an applet?
(A) display() (B) paint() (C)displayApplet() (D)PrintApplet()
3 Which of these class is used for operating on request from the client to the server?
(A) http (B) httpDecoder (C)httpConnection (D)httpd
4 Which of these method is used to start a server thread?
(A) run() (B) runThread() (C)start() (D)startThread()
5 Which of these method of DatagramPacket is used to find the length of byte array?
(A) getnumber() (B) length() (C)Length() (D)getLength()
6 Which of these method of DatagramPacket is used to find the port number?
(A) port() (B) getPort() (C)findPort() (D)receivePort()
7 Which of these methods is used to know host of an URL?
(A) host() (B) getHost() (C)GetHost() (D)gethost()
8 Which of these methods can be used to output a string in an applet?
(A) display() (B) print() (C)drawString() (D)transient()
9 Which of these is wrapper around everything associated with a reply from an http server?
(A) HTTP (B) HttpResponse (C)Httpserver (D)httpserver
10 Arrange the steps involved in developing and testing the applet in correct order.
i) creating an executable applet (.classfile)
ii) preparing <APPLET> tag
iii) creating HTML file
iv) building an applet code (.java file)
v) testing the applet code
(A) 1-i, 2-ii, 3-iii, 4-iv, 5-v (B) 1-ii, 2-iii, 3-iv, 4-v, 5-i (C)1-iv, 2-i, 3-ii, 4-iii, 5-v (D)1-iii, 2-iv, 3-v, 4-i, 5-ii
11 The domain name system is maintained by _______
(A) distributed database system (B) a single server (C)a single computer (D)none of the mentioned
12 The ………………… method called the first time an applet is loaded into the memory of a computer.
(A) init( ) (B) start( ) (C)stop( ) (D)destroy( )
13 Which of these functions is called to display the output of an applet?
(A) display() (B) paint() (C)displayApplet() (D)D. PrintApplet()
14 What does AWT stands for?
(A) All Window Tools (B) All Writing Tools (C)Abstract Window Toolkit (D)Abstract Writing Toolkit
015E78B71B27EBED96F8632E24229118
Examination October 2020
15 What is the Message is displayed in the applet made by the following Java program?
import java.awt.*;
import java.applet.*;
public class myapplet extends Applet
{
public void paint(Graphics g)
{
g.drawString("A Simple Applet", 20, 20);
}
}
(A) Simple Apple (B) A Simple Applet 20 20 (C)Compilation Error (D)Runtime Error
16 Which of these is used to perform all input & output operations in Java?
A. B.
C. D.
(A) streams (B) Variables (C)classes (D)Methods
17 Which of these classes are used by Byte streams for input and output operation?
015E78B71B27EBED96F8632E24229118
Examination October 2020
(A) httpServer (B) ServerSockets (C)MimeHeader (D)HttpResponse
33 How is Date stored in database?
(A) java.sql.Date (B) java.util.Date (C)java.sql.DateTime (D)java.util.DateTime
34 How to get UTC time?
(A) Time.getUTC(); (B) Date.getUTC(); (C)Instant.now(); (D)TimeZone.getUTC();
35 What will be the output of the following Java program?
class Output
{
public static void main(String args[])
{
int x = 3.14;
int y = (int) Math.abs(x);
System.out.print(y);
}}
(A) 0 (B) 3 (C)3.0 (D)3.1
36 Which one of the following contains date information?
(A) java.sql.TimeStamp (B) java.sql.Time (C)java.io.Time (D)java.io.TimeStamp
37 Which of these interface is implemented by Thread class?
(A) Runnable (B) Connections (C)Set (D)MapConnections
38 What does URL stands for?
(A) Uniform Resource Locator (B) Uniform Resource Latch (C)Universal Resource Locator (D)Universal Resource Latch
39 What is the output of this program?
import java.net.*;
class networking
{
public static void main(String[] args) throws UnknownHostException
{
InetAddress obj1 = InetAddress.getByName("cisco.com");
System.out.print(obj1.getHostName());
}
}
015E78B71B27EBED96F8632E24229118
Examination October 2020
46 The ……………………… method is called every time the applet receives focus as a result of scrolling in the active
window.
(A) init( ) (B) start( ) (C)stop( ) (D)destroy( )
47 The Applet class is in ----package
(A) java.applet (B) java.io (C)java.util (D)java.awt
48 Find output of following:
public class Test
{
public static void main (String args[])
{
String str = NULL;
System.out.println(str);
}
}
(A) Null (B) Compile error (C)Code runs but no output (D)Runtime exception
49 What is the return type of the method getID() defined in AWT Event class
(A) Int (B) long (C)Object (D)float.
50 Which provides runtime environment for java byte code to be executed?
(A) JDK (B) JVM (C)JRE (D)JAVAC
51 Which of these methods is used to write() into a file?
(A) put() (B) putFile() (C)write() (D)writeFile()
52 Which of these values is returned by read() method is end of file (EOF) is encountered?
(A) 0 (B) 1 (C)-1 (D)Null
53 ---------------- is the protocol used to transmit hypertext over the Internet.
(A) HTTP (B) TCP (C)FTP (D)None of the above
54 When we invoke repaint() for a Component, the AWT invokes the method.
(A) draw() (B) show() (C)update() (D)paint()
55 Which of these class is necessary to implement datagrams?
(A) DatagramPacket (B) DatagramSocket (C)All of the mentioned (D)None of the mentioned
56 Which of these is an instance variable of class httpd?
(A) port (B) cache (C)log (D)All of the mentioned
57 Which of the following are legal operations?
(A) s3=s1 + s2; (B) s3=s1 - s2; (C)s3=s1 & s2 (D)s3=s1 && s2
58 How would you set the color of a graphics context called g to cyan?
A. B.
C. D.
(A) g.setColor(Color.cyan); (B) g.setCurrentColor(cyan); (C)g.setColor("Color.cyan"); (D)g.setColor("cyan’);
59 Which of the following are passed as an argument to the paint( ) method?
(A) Canvas object (B) Graphics object (C)Image object (D)paint object
60 Which of these operators is used to allocate memory for an object?
(A) malloc (B) alloc (C)new (D)give
015E78B71B27EBED96F8632E24229118