MCQ Bank
Choose correct integer value for predefined Thread Priority "Thread.MIN_PRIORITY" in Java.
- A) 5
- B) 7
- C) 1
- D) 10
Which of the following statement is correct to assign maximum priority to thread “t2”?
- A) t2.setPriority(Thread.MAX_PRIORITY);
- B) t2.setPriority(Thread.PRIORITY_MAX)
- C) t2.setPriority(Thread.PRIORITY_MiX);
- D) t2.setPriority(Thread.MIX_PRIORITY);
In GET HTTP Request type, attribute-value pair is attached after ____________ with requested URL.
- A) @
- B) ?
- C) -
- D) #
In the context of HTTP Response Code, the values in the 200s signify that _________________.
- A) error by client
- B) request was successful
- C) request was not successful
- D) error by server
Choose correct line of code to inherit a Worker class from Thread class in Java.
- A) public class Worker new Thread ()
- B) public class Worker extends Thread ()
- C) public class Worker implement Thread ()
- D) public class Worker inherit Thread ()
Which of the following folder contains configuration file?
- A) WEB-INF
- B) lib
- C) bin
- D) classes
HTTP response code 404 indicates that ________________ .
- A) requested resource is available
- B) request requires HTTP authentication
- C) requested resource is not available
- D) error by server
Since Java is portable and servlets is a Java based technology, therefore they are generally portable across_________________ .
- A) Client computers
- B) Mobile devices
- C) Web servers
- D) Desktop applications
Which of the following is not a servlet related package?
- A) javax.servlet.Servlet
- B) javax.servlet.Svlt
- C) javax.servlet
- D) javax.servlet.http
Which of the following method allows any other thread of same priority to execute?
- A) wait()
- B) sleep()
- C) notify()
- D) yield()
Which of the following method needs to override while handling threads in java?
- A) init()
- B) runnable()
- C) run()
- D) start()
Which of the following is NOT true about HTTP?
- A) HTTP is a request response communication model
- B) HTTP is a stateless protocol
- C) HTTP has no built-in state management between successive requests.
- D) HTTP maintains user session between successive requests.
Thread sleep () method causes the currently executing thread to wait for the time in _________.
- A) Microseconds
- B) Nanoseconds
- C) Milliseconds
- D) Zeptoseconds
Which of the following is true about Apache Tomcat?
- A) It implements Java Servlet and Java Server Pages specifications.
- B) It only supports HTTP protocol.
- C) It can only run on Linux servers.
- D) It is primarily used for running Python applications.
Choose correct integer value for predefined Thread Priority "Thread.NORM_PRIORITY" in Java.
- A) 10
- B) 7
- C) 1
- D) 5
Which of the following range of response code indicates that request was successful?
- A) 400-499
- B) 300-399
- C) 200-299
- D) 100-199
Servlets are commonly used to:
- A) Style web pages with CSS
- B) Store data in a database
- C) Generate dynamic web content
- D) Execute client-side scripts
Choose correct line of code to start a thread 't' in Java.
- A) t->start()
- B) t=start()
- C) t-start()
- D) t.start()
If "MyServlet" is placed in "myapp" folder, then you can access "MyServlet" by writing _______________ url in browser.
- A) http://localhost:8080/myapp/servlets/MyServlet
- B) http://localhost:8080/webapps/myapp/MyServlet
- C) http://localhost:8080/webapps/myapp/servlets/MyServlet
- D) http://localhost:8080/myapp/MyServlet
To compile a servlet (e.g. MyServlet.java) ____________ command is used in command prompt.
- A) java c
- B) java
- C) javac
- D) java-c