Week 6 : Programming Assignment 1
Complete the code segment to print the following using the concept of extending the Thread class in Java:
-----------------OUTPUT-------------------
Thread is Running.
-------------------------------------------------
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | Thread is Running. | Thread is Running. | Passed |
Week 6 : Programming Assignment 2
In the following program, a thread class Question62 is created using the Runnable interface Complete the main() to create a thread object of the class Question62 and run the thread. It should print the output as given below.
-----------------OUTPUT-------------------
Welcome to Java Week 6 New Question.
Main Thread has ended.
-------------------------------------------------
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | Welcome to Java Week 6 New Question.\n
Main Thread has ended. | Welcome to Java Week 6 New Question.\n
Main Thread has ended. | Passed |
Week 6 : Programming Assignment 3
A part of the Java program is given, which can be completed in many ways, for example using the concept of thread, etc. Follow the given code and complete the program so that your program prints the message "NPTEL Java week-6 new Assignment Q3". Your program should utilize the given interface/ class.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | NPTEL Java week-6 new Assignment Q3 | NPTEL Java week-6 new Assignment Q3 | Passed |
Week 6 : Programming Assignment 4
Execution of two or more threads occurs in a random order. The keyword 'synchronized' in Java is used to control the execution of thread in a strict sequence. In the following, the program is expected to print the output as given below. Do the necessary use of 'synchronized' keyword, so that, the program prints the Final sum as given below:
-----------------OUTPUT-------------------
Final sum:6000
-------------------------------------------------
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | Final sum:6000 | Final sum:6000\n
| Passed after ignoring Presentation Error |
Week 6 : Programming Assignment 5
Given a snippet of code, add necessary codes to print the following:
-----------------OUTPUT-------------------
Name of thread 't1':Thread-0
Name of thread 't2':Thread-1
New name of thread 't1':Week 6 Assignment Q5
New name of thread 't2':Week 6 Assignment Q5 New
-------------------------------------------------
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | Name of thread 't1':Thread-0\n
Name of thread 't2':Thread-1\n
New name of thread 't1':Week 6 Assignment Q5\n
New name of thread 't2':Week 6 Assignment Q5 New | Name of thread 't1':Thread-0\n
Name of thread 't2':Thread-1\n
New name of thread 't1':Week 6 Assignment Q5\n
New name of thread 't2':Week 6 Assignment Q5 New\n
| Passed after ignoring Presentation Error |
No comments