NPTEL Programming In Java Assignment 6 Answers 2022

NPTEL Programming In Java Assignment 6

Are you looking for the Answers to NPTEL Programming In Java Assignment 6? This article will help you with the answer to the National Programme on Technology Enhanced Learning (NPTEL) Course NPTEL Programming In Java Assignment 5

What is Programming In Java?

With the growth of Information and Communication Technology, there is a need to develop large and complex software. Further, those software should be platform independent, Internet enabled, easy to modify, secure, and robust. To meet this requirement object-oriented paradigm has been developed and based on this paradigm the Java programming language emerges as the best programming environment. Now, Java programming language is being used for mobile programming, Internet programming, and many other applications compatible to distributed systems. This course aims to cover the essential topics of Java programming so that the participants can improve their skills to cope with the current demand of IT industries and solve many problems in their own filed of studies.

CRITERIA TO GET A CERTIFICATE

Average assignment score = 25% of the average of best 8 assignments out of the total 12 assignments given in the course.
Exam score = 75% of the proctored certification exam score out of 100

Final score = Average assignment score + Exam score

YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF THE AVERAGE ASSIGNMENT SCORE >=10/25 AND EXAM SCORE >= 30/75. If one of the 2 criteria is not met, you will not get the certificate even if the Final score >= 40/100.

Below you can find the answers for NPTEL Programming In Java Assignment 6

Assignment No.Answers
Programming In Java Assignment 1 Click Here
Programming In Java Assignment 2 Click Here
Programming In Java Assignment 3 Click Here
Programming In Java Assignment 4 Click Here
Programming In Java Assignment 5 Click Here
Programming In Java Assignment 6 Click Here
Programming In Java Assignment 7 Click Here
Programming In Java Assignment 8 Click Here

NPTEL Programming In Java Assignment 6 Answers:-

Q1. Complete the code segment to print the following using the concept of extending the Thread class in Java:

MCQ ASSIGNMENT WEEK 6 ANSWERS:- CLICK HERE

public class Question61 extends Thread{
	public void run(){
		System.out.print("Thread is Running.");
	}

Q2. 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.

For Online programming test help and final exam preparation material Click Me

// Create main() method and appropriate statements in it
public static void main(String[] args) {  
        Question62 ex = new Question62();  
        Thread t1= new Thread(ex);  
        t1.setName("Main Thread");
        t1.start();  
        System.out.println("Welcome to Java Week 6 New Question.");  
        t1.setName("Main Thread");
    }

???? Next Week Answers: Assignment 07 ????

quizxp telegram

Q3. 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.

// Class MyThread is defined which extends class B
class MyThread extends B {
	// run() is overriden and 'NPTEL Java' is printed.
	public void run() {
			System.out.print("NPTEL Java week-6 new Assignment Q3");
	}
}

Salesforce off campus Drive 2022 | Intern | Any Graduate | Bangalore/Hyderabad

Q4.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:  

// Returns the sum of a and b. (reader)
// Should always return an even number.
synchronized public int sum() { // line 1 :- answer
return(a+b);
}
// Increments both a and b. (writer)
synchronized public void inc() { //line 2 :- answer
a++;
b++;
}
}

Q5. 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

t1.setName("Week 6 Assignment Q5"); 
t2.setName("Week 6 Assignment Q5 New");

For other courses answers:- Visit

For Internship and job updates:- Visit

Disclaimer: We do not claim 100% surety of answers, these answers are based on our sole knowledge, and by posting these answers we are just trying to help students, so we urge do your assignment on your own.

if you have any suggestions then comment below or contact us at [email protected]

If you found this article Interesting and helpful, don’t forget to share it with your friends to get this information.