On This Page

This set of Advanced JAVA Multiple Choice Questions & Answers (MCQs) focuses on Advanced Java Set 4

Q1 | What requires less resources?
  • thread
  • process
  • thread and process
  • neither thread nor process
Q2 | What does not prevent JVM from terminating?
  • process
  • daemon thread
  • user thread
  • jvm thread
Q3 | What decides thread priority?
  • process
  • process scheduler
  • thread
  • thread scheduler
Q4 | What should not be done to avoid deadlock?
  • avoid using multiple threads
  • avoid hold several locks at once
  • execute foreign code while holding a lock
  • use interruptible locks
Q5 | What is true about threading?
  • run() method calls start() method and runs the code
  • run() method creates new thread
  • run() method can be called directly without start() method being called
  • start() method creates new thread and calls code written in run() method
Q6 | Which of the following is a correct constructor for thread?
  • thread(runnable a, string str)
  • thread(int priority)
  • thread(runnable a, int priority)
  • thread(runnable a, threadgroup t)
Q7 | Which of the following will ensure the thread will be in running state?
  • yield()
  • notify()
  • wait()
  • thread.killthread()
Q8 | Which of these are types of multitasking?
  • process based
  • thread based
  • process and thread based
  • none of the mentioned
Q9 | What will happen if two thread of the same priority are called to be processedsimultaneously?
  • anyone will be executed first lexographically
  • both of them will be executed simultaneously
  • none of them will be executed
  • it is dependent on the operating system
Q10 | In a RMI Client Program, what are the exceptions which might have tohandled?
  • remoteexception
  • notboundexception
  • malformedurlexception
  • all mentioned above
Q11 | Which is a one-way communication only between the client and the server and itis not a reliable and there is no confirmation regarding reaching the message tothe destination?
  • tcp/ip
  • udp
  • both a & b
  • none of the above
Q12 | An RMI Server is responsible for,
  • creating an instance of the remote object
  • exporting the remote object
  • binding the instance of the remote object to the rmi registry
  • all mentioned above
Q13 | In RMI Distributed object applications need to do?
  • locate remote objects
  • communicate with remote objects
  • load class definitions for objects that are passed around
  • all mentioned above
Q14 | In RMI applications which program obtains a remote reference to one ormore remote objects on a server and then invokes methods on them?
  • server
  • client
  • both a & b
  • none of the above
Q15 | Which package is used for Remote Method Invocation (RMI)?
  • java.lang.rmi
  • java.lang.reflect
  • java.applet
  • java.rmi
Q16 | Java supports RMI, RMI Stands for?
  • random method invocation
  • remote memory interface
  • remote method invocation
  • random method invocation
Q17 | Which is built on the top of socket programming?
  • ejb
  • rmi
  • both a & b
  • none of the above
Q18 | Which of these package contains classes and interfaces for networking?
  • java.io
  • java.util
  • java.net
  • javax.swing
Q19 | In the following URL, identify the protocol identifier? https://gtu.ac.in:8080/course.php
  • http
  • gtu.ac.in
  • //gtu.ac.in:80/course.php
  • 8080
Q20 | Which of the following protocol follows connection less service?
  • TCP
  • TCP/IP
  • UDP
  • HTTP
Q21 | Which of the following statement is NOT true?
  • TCP is a reliable but slow.
  • UDP is not reliable but fast.
  • File Transfer Protocol (FTP) is a standard Internet protocol for transmitting files between computers on the Internet over TCP/IP connections.
  • In HTTP, all communication between two computers are encrypted
Q22 | Which of the following statement is TRUE?
  • With stream sockets there is no need to establish any connection and data flows between the processes are as continuous streams.
  • Stream sockets are said to provide a connection-less service and UDP protocol is used
  • Datagram sockets are said to provide a connection-oriented service and TCP protocol is used
  • With datagram sockets there is no need to establish any connection and data flows between the processes are as packets.
Q23 | Which of the following method call is valid to obtain the server's hostname by invokingan applet?
  • getCodeBase().host()
  • getCodeBase().getHost()
  • getCodeBase().hostName()
  • getCodeBase().getHostName()
Q24 | The server listens for a connection request from a client using which of the following statement?
  • Socket s = new Socket(ServerName, port);
  • Socket s = serverSocket.accept()
  • Socket s = serverSocket.getSocket()
  • Socket s = new Socket(ServerName);
Q25 | The client requests a connection to a server using which of the following statement?
  • Socket s = new Socket(ServerName, port);
  • Socket s = serverSocket.accept();
  • Socket s = serverSocket.getSocket();
  • Socket s = new Socket(ServerName);