Explore topic-wise MCQs in Testing Subject.

This section includes 657 Mcqs, each offering curated multiple-choice questions to sharpen your Testing Subject knowledge and support exam preparation. Choose a topic below to get started.

1.

Which of these class must be used to send a datagram packets over a connection?

A. InetAdress
B. DatagramPacket
C. DatagramSocket
D. All of the mentioned
Answer» E.
2.

Which of these method of DatagramPacket is used to find the length of byte array?

A. getnumber()
B. length()
C. Length()
D. getLength()
Answer» E.
3.

Which of these method of DatagramPacket is used to obtain the byte array of data contained in a datagram?

A. getData()
B. getBytes()
C. getArray()
D. recieveBytes()
Answer» B. getBytes()
4.

Which of these method of DatagramPacket is used to find the port number?

A. port()
B. getPort()
C. findPort()
D. recievePort()
Answer» C. findPort()
5.

Which of these class is necessary to implement datagrams?

A. DatagramPacket
B. DatagramSocket
C. All of the mentioned
D. None of the mentioned
Answer» D. None of the mentioned
6.

Which of these is a bundle of information passed between machines?

A. Mime
B. Cache
C. Datagrams
D. DatagramSocket
Answer» D. DatagramSocket
7.

Which of these data member of HttpResponse class is used to store the response from a http server?

A. status
B. address
C. statusResponse
D. statusCode
Answer» E.
8.

Which of these methods is used to know the type of content used in the URL?

A. ContentType()
B. contentType()
C. getContentType()
D. GetContentType()
Answer» D. GetContentType()
9.

Which of these methods is used to know when was the URL last modified?

A. LastModified()
B. getLastModified()
C. GetLastModified()
D. getlastModified()()
Answer» C. GetLastModified()
10.

Which of these transfer protocol must be used so that URL can be accessed by URLConnection class object?

A. http
B. https
C. Any Protocol can be used
D. None of the mentioned
Answer» B. https
11.

Which of these is wrapper around everything associated with a reply from an http server?

A. HTTP
B. HttpResponse
C. HttpRequest
D. httpserver
Answer» C. HttpRequest
12.

Which of these class is used to access actual bits or content information of a URL?

A. URL
B. URLDecoder
C. URLConnection
D. All of the mentioned
Answer» E.
13.

Which of these methods is used to know the full URL of an URL object?

A. fullHost()
B. getHost()
C. ExternalForm()
D. toExternalForm()
Answer» E.
14.

Which of these methods is used to know host of an URL?

A. host()
B. getHost()
C. GetHost()
D. gethost()
Answer» C. GetHost()
15.

Which of these exception is thrown by URL class’s constructors?

A. URLNotFound
B. URLSourceNotFound
C. MalformedURLException
D. MalformedURLException
Answer» D. MalformedURLException
16.

What does URL stands for?

A. Uniform Resource Locator
B. Uniform Resource Latch
C. Universal Resource Locator
D. Universal Resource Latch
Answer» B. Uniform Resource Latch
17.

Which of these method is called when http daemon is acting like a normal web server?

A. Handle()
B. HandleGet()
C. handleGet()
D. Handleget()
Answer» D. Handleget()
18.

Which of these method is used to start a server thread?

A. run()
B. start()
C. runThread()
D. startThread()
Answer» B. start()
19.

Which of these method of httpd class is used to write UrlCacheEntry object into local disk?

A. writeDiskCache()
B. writetoDisk()
C. writeCache()
D. writeDiskEntry()
Answer» B. writetoDisk()
20.

Which of these variables stores the number of hits that are successfully served out of cache?

A. hits
B. hitstocache
C. hits_to_cache
D. hits.to.cache
Answer» E.
21.

Which of these method is used to find a URL from the cache of httpd?

A. findfromCache()
B. findFromCache()
C. serveFromCache()
D. getFromCache()
Answer» D. getFromCache()
22.

Which of these method of httpd class is used to get report on each hit to HTTP server?

A. log()
B. logEntry()
C. logHttpd()
D. logResponse()
Answer» C. logHttpd()
23.

Which of these methods of httpd class is used to read data from the stream?

A. getDta()
B. GetResponse()
C. getStream()
D. getRawRequest()
Answer» E.
24.

Which of these is an instance variable of class httpd?

A. port
B. cache
C. log
D. All of the mentioned
Answer» E.
25.

Which of these method of MimeHeader is used to return the string equivalent of the values stores on MimeHeader?

A. string()
B. toString()
C. convertString()
D. getString()
Answer» C. convertString()
26.

Which of these class is used for operating on request from the client to the server?

A. http
B. httpDecoder
C. httpConnection
D. httpd
Answer» E.
27.

Which of these methods is used to make raw MIME formatted string?

A. parse()
B. toString()
C. getString()
D. parseString()
Answer» B. toString()
28.

Which of these is a standard for communicating multimedia content over email?

A. http
B. https
C. Mime
D. httpd
Answer» D. httpd
29.

Which of these class is used to create servers that listen for either local or remote client programs?

A. httpServer
B. ServerSockets
C. MimeHeader
D. HttpResponse
Answer» C. MimeHeader
30.

Which of these interface abstractes the output of messages from httpd?

A. LogMessage
B. LogResponse
C. Httpdserver
D. httpdResponse
Answer» B. LogResponse
31.

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()); } }

A. cisco
B. cisco.com
C. www.cisco.com
D. none of the mentioned
Answer» C. www.cisco.com
32.

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"); InetAddress obj2 = InetAddress.getByName("sanfoundary.com"); boolean x = obj1.equals(obj2); System.out.print(x); } }

A. 0
B. 1
C. True
D. false
Answer» E.
33.

What is the output of this program? import java.net.*; class networking { public static void main(String[] args) throws UnknownHostException { InetAddress obj1 = InetAddress.getByName("sanfoundary.com"); InetAddress obj2 = InetAddress.getByName("sanfoundary.com"); boolean x = obj1.equals(obj2); System.out.print(x); } }

A. 0
B. 1
C. True
D. false
Answer» D. false
34.

Which of these class is used to encapsulate IP address and DNS?

A. DatagramPacket
B. URL
C. InetAddress
D. ContentHandler
Answer» D. ContentHandler
35.

Which of these is a full form of DNS?

A. Data Network Service
B. Data Name Service
C. Domain Network Service
D. Domain Name Service
Answer» E.
36.

How many bits are in a single IP address?

A. 8
B. 16
C. 32
D. 64
Answer» D. 64
37.

How many ports of TCP/IP are reserved for specific protocols?

A. 10
B. 1024
C. 2048
D. 512
Answer» C. 2048
38.

Which of these is a protocol for breaking and sending packets to an address across a network?

A. TCP/IP
B. DNS
C. Socket
D. Proxy Server
Answer» B. DNS
39.

Which of these package contains classes and interfaces for networking?

A. java.io
B. java.util
C. java.net
D. java.network
Answer» D. java.network
40.

What is the output of this program? import java.io.*; class streams { public static void main(String[] args) { try { FileOutputStream fos = new FileOutputStream("serial"); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeFloat(3.5); oos.flush(); oos.close(); } catch(Exception e) { System.out.println("Serialization" + e); System.exit(0); } try { FileInputStream fis = new FileInputStream("serial"); ObjectInputStream ois = new ObjectInputStream(fis); System.out.println(ois.available()); } catch (Exception e) { System.out.print("deserialization"); System.exit(0); } } }

A. 1
B. 2
C. 3
D. 4
Answer» E.
41.

What is the output of this program? import java.io.*; class streams { public static void main(String[] args) { try { FileOutputStream fos = new FileOutputStream("serial"); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeFloat(3.5); oos.flush(); oos.close(); } catch(Exception e) { System.out.println("Serialization" + e); System.exit(0); } try { FileInputStream fis = new FileInputStream("serial"); ObjectInputStream ois = new ObjectInputStream(fis); ois.close(); System.out.println(ois.available()); } catch (Exception e) { System.out.print("deserialization"); System.exit(0); } } }

A. 1
B. 2
C. 3
D. 0
Answer» E.
42.

What is the output of this program? import java.io.*; class serialization { public static void main(String[] args) { try { Myclass object1 = new Myclass("Hello", -7, 2.1e10); FileOutputStream fos = new FileOutputStream("serial"); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(object1); oos.flush(); oos.close(); } catch(Exception e) { System.out.println("Serialization" + e); System.exit(0); } try { int x; FileInputStream fis = new FileInputStream("serial"); ObjectInputStream ois = new ObjectInputStream(fis); x = ois.readInt(); ois.close(); System.out.println(x); } catch (Exception e) { System.out.print("deserialization"); System.exit(0); } } } class Myclass implements Serializable { String s; int i; double d; Myclass(String s, int i, double d) { this.d = d; this.i = i; this.s = s; } }

A. -7
B. Hello
C. 2.1E10
D. deserialization
Answer» E.
43.

What is the output of this program? import java.io.*; class streams { public static void main(String[] args) { try { FileOutputStream fos = new FileOutputStream("serial"); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeInt(5); oos.flush(); oos.close(); } catch(Exception e) { System.out.println("Serialization" + e); System.exit(0); } try { int z; FileInputStream fis = new FileInputStream("serial"); ObjectInputStream ois = new ObjectInputStream(fis); z = ois.readInt(); ois.close(); System.out.println(x); } catch (Exception e) { System.out.print("deserialization"); System.exit(0); } } }

A. 5
B. void
C. serialization
D. deserialization
Answer» B. void
44.

Which of these is a method of ObjectInput interface used to deserialize an object from a stream?

A. int read()
B. void close()
C. Object readObject()
D. Object WriteObject()
Answer» D. Object WriteObject()
45.

Which of these interface extends DataInput interface?

A. Serializable
B. Externalization
C. ObjectOutput
D. ObjectInput
Answer» E.
46.

Which of these process occur automatically by java run time system?

A. Serialization
B. Memory allocation
C. Deserialization
D. All of the mentioned
Answer» E.
47.

Which of these is a process of extracting/removing the state of an object from a stream?

A. Serialization
B. Externalization
C. File Filtering
D. Deserialization
Answer» E.
48.

Serializaed object can be transferred via network.

A. True
B. False
Answer» B. False
49.

Which of the following methods is not used while Serialization and DeSerialization?

A. readObject()
B. readExternal()
C. readWriteObject()
D. writeObject()
Answer» D. writeObject()
50.

Which of the following methods is used to avoid serialization of new class whose super class already implements Serialization?

A. writeObject()
B. readWriteObject()
C. writeReadObject()
D. unSerializaedObject()
Answer» B. readWriteObject()