About Threaded Joints

Following are some of the multiple choice questions on the Threaded Joints with answers that will help the students in developing their knowledge.

Threaded Joints MCQ

1. Which of the following are methods of the Thread class? 1) yield() 2) sleep(long msec) 3) go() 4) stop()

  • 1 , 2 and 4
  • 1 and 3
  • 3 only
  • None of the above

2. What notifyAll() method do?

  • Wakes up one threads that are waiting on this object's monitor
  • Wakes up all threads that are not waiting on this object's monitor
  • Wakes up all threads that are waiting on this object's monitor
  • None of the above

3. This is the bottom surface joining the sides of two adjacent threads:

  • Lead
  • Pitch
  • Crest
  • Root

4. These include taper pins, straight pins, dowel pins, clevis pins, and cotter pins:

  • Bolts
  • General fasteners
  • Machine pins
  • Rivets

5. Analyze the following code: public abstract class Test implements Runnable{ public void doSomething() { }; }

  • The program will not compile because it does not implement the run() method.
  • The program will not compile because it does not contain abstract methods.
  • The program compiles fine.
  • None of the above

6. Analyze the following code: public class Test implements Runnable{ public static void main(String[] args){ Test t = new Test(); t.start(); } public void run() { } }

  • The program does not compile because the start() method is not defined in the Test class.
  • The program compiles, but it does not run because the start() method is not defined.
  • The program compiles, but it does not run because the run() method is not implemented.
  • The program compiles and runs fine.

7. What will be the output of the following program code? public class Test implements Runnable{ public static void main(String[] args){ Thread t = new Thread(this); t.start(); } public void run(){ System.out.println("test"); } }

  • The program does not compile because this cannot be referenced in a static method.
  • The program compiles fine, but it does not print anything because t does not invoke the run() method
  • The program compiles and runs fine and displays test on the console.
  • None of the above

8. What will happen when you attempt to compile and run the following code? 1. public class Test extends Thread{ 2. public static void main(String argv[]){ 3. Test t = new Test(); 4. t.run(); 5. t.start(); 6. } 7. public void run(){ 8. System.out.println("run-test"); 9. } 10. }

  • run-test run-test
  • run-test
  • Compilation fails due to an error on line 4
  • Compilation fails due to an error on line 7

9. When a class extends the Thread class ,it should override ............ method of Thread class to start that thread.

  • start()
  • run()
  • init()
  • go()

10. What will be the output? class One extends Thread{ public void run(){ for(int i=0; i

  • 0 0
  • Compilation Error
  • 0 1
  • None of these

11. What will be output of the following program code? public class Test implements Runnable{ public void run(){ System.out.print("go"); } public static void main(String arg[]) { Thread t = new Thread(new Test()); t.run(); t.run(); t.start(); } }

  • Compilation fails.
  • An exception is thrown at runtime.
  • "go" is printed
  • "gogogo" is printed

12. What will be the output after compiling and executing the following code? public class Test implements Runnable{ public static void main(String[] args) throws InterruptedException{ Thread a = new Thread(new Test()); a.start(); System.out.print("Begin"); a.join(); System.out.print("End"); } public void run(){ System.out.print("Run"); } }

  • Compilation fails.
  • An exception is thrown at runtime.
  • "BeginRunEnd" is printed.
  • "BeginEndRun" is printed.

13. What is the output for the below code ? class A implements Runnable{ public void run(){ System.out.println(Thread.currentThread().getName()); } } 1. public class Test{ 2. public static void main(String... args){ 3. A a = new A(); 4. Thread t = new Thread(a); 5. t.setName("good"); 6. t.start(); 7. } 8. }

  • good
  • null
  • Compilation fails with an error at line 5
  • Compilation succeed but Runtime Exception

14. What will happen after compiling and running following code? class A implements Runnable{ public void run(){ System.out.println("run-a"); } } 1. public class Test{ 2. public static void main(String... args){ 3. A a = new A(); 4. Thread t = new Thread(a); 5. t.start(); 6. t.start(); 7. } 8. }

  • run-a
  • run-a run-a
  • Compilation fails with an error at line 6
  • Compilation succeed but Runtime Exception

15. What is the output for the below code ? public class Test extends Thread{ public static void main(String argv[]){ Test t = new Test(); t.run(); } public void start(){ for(int i = 0; i < 10; i++){ System.out.println("Value of i = " + i); } } }

  • A compile time error indicating that no run method is defined for the Thread class
  • A run time error indicating that no run method is defined for the Thread class
  • Clean compile and at run time the values 0 to 9 are printed out
  • Clean compile but no output at runtime

16. Which keyword when applied on a method indicates that only one thread should execute the method at a time.

  • volatile
  • synchronized
  • native
  • static

17. What will be the output? class A extends Thread{ public void run(){ for(int i=0; i

  • 0 0
  • Compilation error, class A has no start method
  • 0 1
  • Compilation succeed but runtime exception

18. Which of the following constructor of class Thread is valid one?

  • Thread(Runnable threadOb, int priority)
  • Thread(int priority)
  • Thread(Runnable threadOb, String threadName)
  • Thread(String threadName, int priority)

19. In java a thread can be created by ..........

  • Extending the thread class.
  • Implementing Runnable interface.
  • Both of the above
  • None of these

20. The distance a screw thread advances axially in one turn is the:

  • Lead
  • Pitch
  • Turn
  • Crest

21. Given the code. What will be the result? public class Test implements Runnable{ public static void main(String[] args) throws InterruptedException{ Thread a = new Thread(new Test()); a.start(); System.out.print("Begin"); a.join(); System.out.print("End"); } public void run(){ System.out.print("Run"); } }

  • Compilation fails.
  • An exception is thrown at runtime.
  • "BeginRunEnd" is printed.
  • "BeginEndRun" is printed.

22. Predict the output: public class Test extends Thread{ private int i; public void run(){ i++; } public static void main(String[] args){ Test a = new Test(); a.run(); System.out.print(a.i); a.start(); System.out.print(a.i); } }

  • Prints
  • Prints
  • Prints
  • Compiler error

23. Predict the output: class A implements Runnable{ public void run(){ try{ for(int i=0;i

  • A A A A B B B B
  • A B A B A B A B
  • Output order is not guaranteed
  • Compilation succeed but Runtime Exception

24. This is the smallest diameter of a screw thread:

  • Internal thread diameter
  • Minor diameter
  • Major diameter
  • External thread diameter

25. This type of thread is a thread on the inside of a member:

  • Basic thread
  • External thread
  • Internal thread
  • Major diameter thread

26. This type of fit is high quality and is used for the bulk of interchangeable screw thread work:

  • Class 1
  • Class 2
  • Class 3
  • Class 4

27. The standard number of threads per inch for various diameters is the:

  • Series of thread
  • Lead
  • Major diameter
  • Thread pitch

Enjoyed the Quiz. Share this with friends

Comments

Add Your Review

Your email address will not be published.

Subscribe to Newsletter!

Subscribe to get latest updates and information.