WorksheetsPractice Questionson Multithreading and Junit
Total questions: 62
Worksheet time: 31mins
How many ways a thread can be created in Java multithreading?
1
2
5
10
Which method is used to make main thread to wait for all child threads
Join ()
Sleep ()
Wait ()
Stop ()
Which will contain the body of the thread in Java?
Start()
Run()
Main()
Execute()
The life cycle of a thread in java is controlled by
JRE
JDK
JVM
None
Which method is used to get current running thread object?
runningThread()
currentThread()
runnableThread()
None
Synchronized static methods acquire lock on
Class
Object
Interface
None
Thread priority in Java is?
Integer
Float
Double
Long
In JAVA multi threading, a thread can be created by_______
Extending class
Implementing Runnable Interface
both
none
Which statements is/are correct
On calling Thread start ( ) method a new thread is created
Thread start( ) method call run( ) method internally
Thread run( ) method can also be called directly to create thread
both a & b
Q) What is maximum thread priority in Java
10
12
5
8
Q) Number of threads in below java program is
public class ThreadExtended extends Thread {
public void run() {
System.out.println("\nThread is running now\n");
}
public static void main(String[] args) {
ThreadExtended threadE = new ThreadExtended();
threadE.start();
}
}
0
1
2
3
Q) Execution of a java thread begins on which method call?
Start ()
Run ()
Execute ()
Launch ()
Q) Which method is used to check if a thread is running?
isAlive()
run ()
alive ()
keepAlive()
Q) Min and Max priority of a thread in Java multithreading are
1, 10
0,10
0,255
1,256
___________distributing task across multiple computing cores
data parallelism
implicit threading
task parallelism
identifying task
Execution of a java thread begins on which method call?
Run ()
Start ()
Execute ()
Launch ()
Choose THREE(3) benefits of multithreaded processing
scalability
resource sharing
privacy
responsiveness
Thread is _____________process that can run independently
heavyweight
lightweight
compaction
compression
Which of the following describes Testing correctly?
A - Testing is the process of checking the functionality of the application whether it is working as per requirements.
B - Testing is the testing of single entity (class or method).
C - Both of the above.
D - None of the above.
Which of the following class contains methods to collect the results of executing a test case?
A - Assert
B - TestCase
C - TestResult
D - TestSuite
Is it necessary to write the test case for every logic?
Yes
No
If the JUnit method's return type is 'string', what will happen?
the execution will Pass
the execution will fail.
the execution will Not Excute
syntax error
Is it necessary to write the test class to test every class?
Yes
NO
Which method is used to verify the actual and expected results in Junits?
equals()
isEqual()
==
assert()
JUnits are used for which type of testing?
Blackbox Testing
Unit Testing
System Testing
Integration Testing
Assert contains a set of assert methods.
A - true
B - false
Automated Test cases are executed by using automation tool so less tester are required in automation testing.
A - true
B - false
what is integration testing??
Testing the each module individually
Tetsing two or more modules after combining
Is there any direct way to test "Private Method"?
Yes
No
Is JUnit only report the first failure in a single test ?
Yes
No
What is the most basic type of developer level test?
Integration Test
Universal Test
Unit Test
Basic Test
Which of the following is not a desirable quality of "a unit test"?
Tests one property at one time
Fast
I/O or File Operations
Covering a small portion of code
What is the significance of writing a failing test?
We should not. We should focus on writing a test that passes
A failing test shows that some code change is required in our program. If it is not failing, no change required.
A failing test shows that the previous developer didn't do a good job.
A failing test gives you an opportunity to enhance code coverage
What is a test?
A measure to check if the code meets the defined specifications
A measure to check if the code is visually beautiful
A measure to check if the code contains security vulnerabilities?
A measure to increase code coverage
I need to test if a service method is fine or not. What type of test do I need to write?
Unit Test
Integration Test
Selenium Test
Black Box Test
Which of the following describes Testing correctly?
A - Testing is the process of checking the functionality of the application whether it is working as per requirements.
B - Testing is the testing of single entity (class or method).
C - Both of the above.
D - None of the above.
Which of the following class contains methods to collect the results of executing a test case?
A - Assert
B - TestCase
C - TestResult
D - TestSuite
Which of the following annotation causes that method run once after all tests have finished?
A - @Test
B - @After
C - @BeforeClass
D - @AfterClass
Which of the following method of Assert class checks that an object is null?
A - void assert(Object object, boolean toCheckAsNull)
B - void assertCheck(Object object, boolean toCheckAsNull)
C - void assertNull(Object object)
D - void assertChecks(Object object, boolean toCheckAsNull)
@RunWith and @Suite annotation are used to run the suite test.
A - false
B - true
Automated Test cases are executed by using automation tool so less tester are required in automation testing.
A - true
B - false
Assert contains a set of assert methods.
A - true
B - false
Which of the following method of Assert class checks that a condition is true?
A. void assert(boolean condition)
B. void assertTrue(boolean condition)correct
C. void assertCheck(boolean condition)
D. void assertChecks(boolean condition)
Which of the following method of TestSuite class adds the tests from the given class to the suite?
A. void addTest(Class testClass)wrong
B. void addTestSuite(Class testClass)correct
C. void addTest(TestCase testClass)
D. void addTestCase(TestCase testClass)
JUnits are used for which type of testing?
Blackbox Testing
Unit Testing
System Testing
Integration Testing
Which of the below is an incorrect annotation with respect to JUnits?
@Junit
@AfterEach
@Test
@BeforeClass
Which method is used to verify the actual and expected results in Junits?
equals()
isEqual()
==
assert()
What does assertSame() method use for assertion?
equals() method
isEqual() method
==
compare() method
What is the use of Junit
To increase code coverage
To test unit of code thoroughly
To integrate with other units of code
Is it necessary to write the test case for every logic?
Yes
No
Is there any direct way to test "Private Method"?
Yes
No
Is JUnit only report the first failure in a single test ?
Yes
No
What is the most basic type of developer level test?
Integration Test
Universal Test
Unit Test
Basic Test
which of the following are framework of testings (testing frameworks)
JUNIT
JUNIT and WordPress
Selenium
Selenium and REST
Assert.assertEquals(calculadoraSimple.suma("1", "2"), 5);
Assert OK
Assert Failure
Assert Exception
Assert.assertEquals(calculadoraSimple.suma(null, "2"), 5);
Assert OK
Assert Failure
Assert Exception
Assert.assertNotEquals(calculadoraSimple.suma("5", "2"), 3);
Assert OK
Assert Failure
Assert Exception
@Test(expected = RuntimeException.class)
...
Assert.assertEquals(calculadora.suma(null, "2"), 3);
Assert OK
Assert Failure
Assert Exception
MAVEN needs
web.xml
manifest.yml
pom.xml
all of them
