Explore topic-wise MCQs in Technical Programming.

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

1001.

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.
1002.

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.
1003.

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()
1004.

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

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

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
1006.

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

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

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.
1008.

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()
1009.

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()
1010.

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
1011.

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
1012.

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.
1013.

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.
1014.

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

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

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

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

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
1017.

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()
1018.

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

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

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()
1020.

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.
1021.

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()
1022.

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()
1023.

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.
1024.

Which of these is an instance variable of class httpd?

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

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()
1026.

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.
1027.

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

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

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

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

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
1030.

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

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

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
1032.

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.
1033.

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
1034.

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

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

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.
1036.

How many bits are in a single IP address?

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

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

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

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
1039.

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
1040.

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.
1041.

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.
1042.

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.
1043.

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
1044.

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()
1045.

Which of these interface extends DataInput interface?

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

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.
1047.

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.
1048.

Serializaed object can be transferred via network.

A. True
B. False
Answer» B. False
1049.

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

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

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