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.

what does public String replaceAll(string replace) do?

A. Replace all characters that matches pattern with replacement string
B. Replace first subsequence that matches pattern with replacement string
C. Replace all other than first subsequence of that matches pattern with replacement string
D. Replace every subsequence of the input sequence that matches pattern with replacement string
Answer» E.
2.

What does public int end(int group) return?

A. offset from last character of the subsequent group
B. offset from first character of the subsequent group
C. offset from last character matched
D. offset from first character matched
Answer» B. offset from first character of the subsequent group
3.

Which of the following matches nonword character using regular expression in java?

A. w
B. W
C. s
D. S
Answer» C. s
4.

Which capturing group can represent the entire expression?

A. group *
B. group 0
C. group * or group 0
D. None of the mentioned
Answer» C. group * or group 0
5.

Object of which class is used to compile regular expression?

A. Pattern class
B. Matcher class
C. PatternSyntaxException
D. None of the mentioned
Answer» B. Matcher class
6.

What is the significance of Matcher class for regular expression in java?

A. interpretes pattern in the string
B. Performs match in the string
C. interpreted both pattern and performs match operations in the string
D. None of the mentioned.
Answer» D. None of the mentioned.
7.

Which of the following is not a class of java.util.regex?

A. Pattern class
B. matcher class
C. PatternSyntaxException
D. Regex class
Answer» E.
8.

Which of these formatting strings of SimpleDateFormat class is used to print AM or PM in time?

A. a
B. b
C. c
D. d
Answer» B. b
9.

Which of these class allows us to define our own formatting pattern for dates and time?

A. DefinedDateFormat
B. SimpleDateFormat
C. ComplexDateFormat
D. UsersDateFormat
Answer» C. ComplexDateFormat
10.

Which of these method returns an instance of DateFormat that can format time information?

A. getTime()
B. getTimeInstance()
C. getTimeDateinstance()
D. getDateFormatinstance()
Answer» C. getTimeDateinstance()
11.

Which of this class can be used to format dates and times?

A. Date
B. SimpleDate
C. DateFormat
D. textFormat
Answer» D. textFormat
12.

Which of these package is used for text formatting in Java programming language?

A. java.text
B. java.awt
C. java.awt.text
D. java.io
Answer» B. java.awt
13.

Which of these operators can be used to get run time information about an object?

A. getInfo
B. Info
C. instanceof
D. getinfoof
Answer» D. getinfoof
14.

Which of these modifiers can be used for a variable so that it can be accessed from any thread or parts of a program?

A. transient
B. volatile
C. global
D. No modifier is needed
Answer» C. global
15.

Which of these methods is a part of Abstract Window Toolkit (AWT) ?

A. display()
B. paint()
C. drawString()
D. transient()
Answer» C. drawString()
16.

Which of these methods can be used to output a string in an applet?vvvv

A. display()
B. print()
C. drawString()
D. transient()
Answer» D. transient()
17.

Which of these functions is called to display the output of an applet?

A. display()
B. paint()
C. displayApplet()
D. PrintApplet()
Answer» C. displayApplet()
18.

Which of these methods is used to write() into a file?

A. put()
B. putFile()
C. write()
D. writeFile()
Answer» D. writeFile()
19.

Which of these values is returned by read() method is end of file (EOF) is encountered?

A. 0
B. 1
C. 1
D. Null
Answer» D. Null
20.

Which of these methods are used to read in from file?

A. get()
B. read()
C. scan()
D. readFileInput()
Answer» C. scan()
21.

Which of these exception is thrown in cases when the file specified for writing it not found?

A. IOException
B. FileException
C. FileNotFoundException
D. FileInputException
Answer» D. FileInputException
22.

Which of these class contains the methods used to write in a file?

A. FileStream
B. FileInputStream
C. BUfferedOutputStream
D. FileBufferStream
Answer» C. BUfferedOutputStream
23.

Which of these classes are used by character streams output operations?

A. InputStream
B. Writer
C. ReadStream
D. InputOutputStream
Answer» C. ReadStream
24.

Which of these methods can be used to writing console output?

A. print()
B. println()
C. write()
D. all of the mentioned
Answer» E.
25.

Which of these class contains the methods print() & println()?

A. System
B. System.out
C. BUfferedOutputStream
D. PrintStream
Answer» E.
26.

Which of these class is used to read from a file?

A. InputStream
B. BufferedInputStream
C. FileInputStream
D. BufferedFileInputStream
Answer» D. BufferedFileInputStream
27.

Which of these class is implemented by FilterInputStream class?

A. InputStream
B. InputOutputStream
C. BufferedInputStream
D. SequenceInputStream
Answer» B. InputOutputStream
28.

Which of these class is used to read characters and strings in Java from console?

A. BufferedReader
B. StringReader
C. BufferedStreamReader
D. InputStreamReader
Answer» B. StringReader
29.

Which of these is used to read a string from the input stream?

A. get()
B. getLine()
C. read()
D. readLine()
Answer» D. readLine()
30.

Which exception is thrown by read() method?

A. IOException
B. InterruptedException
C. SystemException
D. SystemInputException
Answer» B. InterruptedException
31.

Which of these class is used to read from byte array?

A. InputStream
B. BufferedInputStream
C. ArrayInputStream
D. ByteArrayInputStream
Answer» E.
32.

Which of these classes are used by character streams for input and output operations?

A. InputStream
B. Writer
C. ReadStream
D. InputOutputStream
Answer» C. ReadStream
33.

Which of these classes are used by Byte streams for input and output operation?

A. InputStream
B. InputOutputStream
C. Reader
D. All of the mentioned
Answer» B. InputOutputStream
34.

Which of these is a type of stream in Java?

A. Integer stream
B. Short stream
C. Byte stream
D. Long stream
Answer» D. Long stream
35.

Which of these is used to perform all input & output operations in Java?

A. streams
B. Variables
C. classes
D. Methods
Answer» B. Variables
36.

What does AWT stands for?

A. All Window Tools
B. All Writing Tools
C. Abstract Window Toolkit
D. Abstract Writing Toolkit
Answer» D. Abstract Writing Toolkit
37.

Which of these method wakes up all the threads?

A. wakeAll()
B. notify()
C. start()
D. notifyAll()
Answer» E.
38.

Which of these method wakes up the first thread that called wait()?

A. wake()
B. notify()
C. start()
D. notifyAll()
Answer» C. start()
39.

Which of these method is used to tell the calling thread to give up monitor and go to sleep until some other thread enters the same monitor?

A. wait()
B. notify()
C. notifyAll()
D. sleep()
Answer» B. notify()
40.

Which of these method is used to avoid polling in Java?

A. wait()
B. notify()
C. notifyAll()
D. all of the mentioned
Answer» E.
41.

Which of these keywords are used to implement synchronization?

A. synchronize
B. syn
C. synch
D. synchronized
Answer» E.
42.

Which of the following will ensure the thread will be in running state?

A. yield()
B. notify()
C. wait()
D. Thread.killThread()
Answer» D. Thread.killThread()
43.

Which of the following stops execution of a thread

A. Calling SetPriority() method on a Thread object
B. Calling notify() method on an object
C. Calling wait() method on an object
D. Calling read() method on an InputStream object
Answer» C. Calling wait() method on an object
44.

What is true about threading?

A. run() method calls start() method and runs the code
B. run() method creates new thread
C. run() method can be called directly without start() method being called
D. start() method creates new thread and calls code written in run() method
Answer» E.
45.

What should not be done to avoid deadlock?

A. Avoid using multiple threads
B. Avoid hold several locks at once
C. Execute foreign code while holding a lock
D. Use interruptible locks
Answer» D. Use interruptible locks
46.

Deadlock is a situation when thread is waiting for other thread to release acquired object?

A. True
B. False
Answer» B. False
47.

What decides thread priority?

A. Process
B. Process scheduler
C. Thread
D. Thread scheduler
Answer» E.
48.

What does not prevent JVM from terminating?

A. Process
B. Daemon Thread
C. User Thread
D. JVM Thread
Answer» C. User Thread
49.

What requires less resources?

A. Thread
B. Process
C. Thread and Process
D. Neither Thread nor Process
Answer» B. Process
50.

What will happen if two thread of same priority are called to be processed simultaneously?

A. Anyone will be executed first lexographically
B. Both of them will be executed simultaneously
C. None of them will be executed
D. It is dependent on the operating system
Answer» E.