Programming in Java Nptel Week 6 Assignment Answers
Are you looking for Programming in Java Nptel Week 6 Assignment Answers? You’ve come to the right place! Access the latest and most accurate solutions for your Week 6 assignment in the Programming in Java course
Course Link: Click Here
Table of Contents
Programming in Java Nptel Week 6 Assignment Answers (July-Dec 2024)
1. What is the output of the following program?
a. “Hello World” b. “Cannot divide by 0” c. Compilation Error d. Runtime Error (the code compiles successfully)
Answer: c. Compilation Error
2. What will be the output of the following program?
a. 20 b. 21 c. 19 d. 22
Answer: b. 21
For answers or latest updates join our telegram channel: Click here to join
3. What is the output of the following program? a. 1 b. 2 c. 0 d. Compilation Error
Answer : c. 0
4. Which exception is thrown when an array element is accessed beyond the array size? a. ArrayElementOutOfBounds b. ArrayIndexOutOfBoundsException c. ArrayIndexOutOfBounds d. None of these
Answer: b. ArrayIndexOutOfBoundsException
These are Programming in Java Nptel Week 5 Assignment Answers
5. What is the output of the following program? a. java b. java course c. nptel course d. Compilation Error
Answer: d. Compilation Error
6. Fill in the blank in the program so that the output is “Java”.
a. public void b. void c. private void d. static void
Answer: a. public void
7. How many times will “Java” be printed if the following code is executed?
a. 0 b. 1 c. 2 d. 3
Answer: c. 2
8. The following is a simple program using the concept of thread. What is the output of the following program?
a. 1 3 5 7 b. 2 4 6 8 c. 1 3 5 7 9 d. 2 4 6
Answer: b. 2 4 6 8
9. For the program given below, what will be the output after its execution?
a. 1 b. 2 c. 0 d. 01
Answer: a. 1
10. Which of the following method returns a reference to the currently executing thread object? a. public static boolean interrupted(); b. public static Thread currentThread(); c. public final boolean isAlive(); d. public final void suspend();
Answer: b. public static Thread currentThread();
All Weeks of Programming In Java: Click Here
For answers to additional Nptel courses, please refer to this link: NPTEL Assignment Answers
Programming in Java Nptel Week 6 Assignment Answers (JAN-APR 2024 )
Course name: Programming In Java
For answers or latest updates join our telegram channel: Click here to join
These are NPTEL Programming In Java Week 6 Assignment Answers
Q1. What is the output of the following program? a. “Programming In Java” b. Run time error c. Compile time error d. ArithmeticException
Answer: c. Compile time error c. Compile time error
Q2. What is the output of the following program? a. 1 3 b. 1 2 3 4 c. Runtime error d. 1 2
Answer: a. 1 3
Q3. For the program given below, what will be the output after its execution? a. 0 b. true c. 1 d. false
Answer: c. 1
Q4. Which of the following is a correct constructor for a thread object? a. Thread(Runnable a, String str); b. Thread(Runnable a, int priority); c. Thread(Runnable a, ThreadGroup t); d. Thread(int priority);
Answer: a. Thread(Runnable a, String str);
Q5. What is the output of the following program? a. Compiler Error b. “Running” c. Runtime Exception d. No output, but no error
Answer: b. “Running”
Q6. How many threads does the following program run on? a. 0 b. 1 c. 2 d. 3
Q7. In the following java program, what is the NAME of the thread? a. thread b. main c. system d. None of the above
Answer: b. main
Q8. Which of the following line(s) of code is suitable to START a thread at #1? a. Thread t = new Thread(Nptel); b. Thread t = new Thread(Nptel); t.start(); c. Nptel run = new Nptel(); Thread t = new Thread(run); t.start(); d. Thread t = new Thread(); Nptel.run();
Answer: c. Nptel run = new Nptel(); Thread t = new Thread(run); t.start();
Q9. What is the name of the priority of this Thread in this program? a. 1 b. 4 c. 0 d. 5
Answer: d. 5
Q10. What does I/O stand for in Java? a. Input/Output b. Inheritance/Overriding c. Integer/Object d. Iteration/Observation
Answer: a. Input/Output
Programming Assignment
Question 1 Complete the code fragment to read two integer inputs from keyboard and find the quotient and remainder.
Question 2 Complete the code segment to count number of digits in an integer using while loop.
Question 3 Complete the code segment to display the factors of a number n.
Question 4 Complete the code segment to find the standard deviation of the 1-D array. Use the following formula: σ=√(1/N∑N to i=1(X i −μ) 2 ) Here, σ = Population standard deviation N = Number of observations in the population Xi = ith observation in the population μ = Population mean
Question 5 Write a program which will print a pattern of “*” ‘s of height “n”. For example: Input: n = 3 Output: *** ** * ** ***
More Weeks of Programming In Java: Click here
More Nptel Courses: https://progiez.com/nptel-assignment-answers
Programming in Java Nptel Week 6 Assignment Answers (JULY-DEC 2023 )
Course Name: Programming In Java
These are Programming In Java Assignment 6 Answers
Question 1 Complete the code segment to print the following using the concept of extending the Thread class in Java: —————–OUTPUT——————- Thread is Running. ————————————————-
Question 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. ————————————————-
Question 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.
Question 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 ————————————————-
Question 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 ————————————————-
More Nptel Courses: Click here
- Thursday, September 26, 2024
NPTEL Programming in Java Week 6 Assignment Solution 2023
NPTEL Programming in Java Week 6 All Programming Assignment Solutions – Jan 2023 | Swayam. 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.
COURSE LAYOUT
- Week 1 : Overview of Object-Oriented Programming and Java
- Week 2 : Java Programming Elements
- Week 3 : Input-Output Handling in Java
- Week 4 : Encapsulation
- Week 5 : Inheritance
- Week 6 : Exception Handling
- Week 7 : Multithreaded Programming
- Week 8 : Java Applets and Servlets
- Week 9 : Java Swing and Abstract Windowing Toolkit (AWT)
- Week 10 : Networking with Java
- Week 11: Java Object Database Connectivity (ODBC)
- Week 12: Interface and Packages for Software Development
Course Name : “Programming in Java 2023”
Question : 1 Complete the code segment to print the following using the concept of extending the Thread class in Java:
—————–OUTPUT——————-
Thread is Running.
————————————————-
Question : 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.
Welcome to Java Week 6 New Question.
Main Thread has ended.
Question : 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. Invalid HTML tag: tag name o:p is not allowed
Question : 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:
Final sum:6000
Question : 5 Given a snippet of code, add necessary codes to print the following:
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
- All Courses
- Privacy Policy
Swayam Solver
Learn Programming & Prepare for NPTEL Exams... Swayam Solver is your one-stop destination for NPTEL exam preparation.
NPTEL Programming in Java Jan 2024 Week 6 to 12
Please scroll down for latest Programs. 👇
Week 6 : Programming Assignment 1
Week 6 : programming assignment 2, week 6 : programming assignment 3, week 6 : programming assignment 4, week 6 : programming assignment 5, week 7 : programming assignment 1.
- a parameterized constructor to initialize the private fields
- the getter/setter methods for each field
Week 7 : Programming Assignment 2
- a parameterized constructor to initialize the private field
- public void deposit(...) // to deposit money
- public void withdraw(...) // to withdraw money, should print "Insufficient funds!" if not enough money to withdraw
- public double getBalance() // to return the current balance
Week 7 : Programming Assignment 3
- a parameterized constructor to initialize the Circle class
- @Override the area function to compute the area of a circle ( Use Math.PI for value of pi, not 22/7)
- @Override the displayInfo() function to print exactly in the format provided by the test cases.
Week 7 : Programming Assignment 4
- Create a class "Circle" that implements the "Shape" interface and provides its own implementation for calculateArea().
- Create another class "Rectangle" that implements the "Shape" interface and provides its own implementation for calculateArea().
- @Override the area function to compute the area of a rectangle
Week 7 : Programming Assignment 5
- Create a class "FlyingFish" that implements both interfaces and provides its own implementation for fly() and swim()
- It should have a private variable name, use a constructor to set the value and the functions fly() and swim() to print exactly as given in the test case.
Week 8 : Programming Assignment 1
- name (String)
- sound (String)
- public void makeSound() - This method should display the name of the animal and the sound it makes.
Week 8 : Programming Assignment 2
Week 8 : programming assignment 3, week 8 : programming assignment 4, week 8 : programming assignment 5, no comments:, post a comment.
Keep your comments reader friendly. Be civil and respectful. No self-promotion or spam. Stick to the topic. Questions welcome.
COMMENTS
Java Week 6:Q2 In the following program, a thread class ThreadRun is created using the Runnable interface which prints "Thread using Runnable interface". Complete the main class to create a thread object of the class ThreadRun and run the thread, Java Week 6: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 ...
Question 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".
Programming In Java Week 6 Assignment 6 Answers Solution Quiz | 2024-JanJoin NPTEL - Programming in Java : https://telegram.me/ProgrammingInJavaNPTELFollow W...
Question : 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.
These files contain the assignment answers for each respective week. Select the Week File: Click on the file corresponding to the week you are interested in. For example, if you need answers for Week 3, open the week-03.md file. Review the Answers: Each week-XX.md file provides detailed solutions and explanations for that week's assignments ...
Welcome to our channel! In this video, we provide detailed answers and explanations for the Week 6 assignment of the NPTEL course on "Programming in Java." W...
02/07/2020 Programming in Java - Course https://onlinecourses.nptel.ac.in/noc20_cs08/progassignment?name=142 3/3 Assignment Solution Books Live Interactive
//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". Your program should utilize the given interface/ class.
NPTEL Programming in Java Jan 2024 Week 6 to 12 Posted on March 01, 2024 Please scroll down for latest Programs. 👇 . Week 6 : Programming Assignment 1. Due on 2024-03-14, 23:59 IST. Complete the code fragment to read two integer inputs from keyboard and find the quotient and remainder.
Welcome to our detailed walkthrough of the "NPTEL Programming in Java Week 6 Solution for August 2024," brought to you by IIT Kharagpur. This video is design...