Skip to content

Commit 0d0597f

Browse files
Update Index Week 6
Week 6
1 parent 234f486 commit 0d0597f

File tree

1 file changed

+92
-4
lines changed

1 file changed

+92
-4
lines changed

docs/README.md

+92-4
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,99 @@ Circle: This is Shape2
7272

7373
-----------------OUTPUT--------------------
7474

75+
## [WEEK 5](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/tree/WEEK-5)
7576

76-
## [WEEK 5](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/tree/WEEK-1)
77+
[Java Week 5:Q1](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-5/Question5_1.java)
78+
An interface Number is defined in the following program. You have to declare a class A, which will implement the interface Number. Note that the method findSqr(n) will return the square of the number n.
79+
80+
[Java Week 5:Q2](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-5/Question5_2.java)
81+
This program is to find the GCD (greatest common divisor) of two integers writing a recursive function findGCD(n1,n2). Your function should return -1, if the argument(s) is(are) other than positive number(s).
82+
83+
[Java Week 5:Q3](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-5/Question5_3.java)
84+
Complete the code segment to catch the ArithmeticException in the following, if any. On the occurrence of such an exception, your program should print “Exception caught: Division by zero.” If there is no such exception, it will print the result of division operation on two integer values.
85+
86+
[Java Week 5:Q4](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-5/Question5_4.java)
87+
In the following program, an array of integer data to be initialized. During the initialization, if a user enters a value other than integer value, then it will throw InputMismatchException exception. On the occurrence of such an exception, your program should print “You entered bad data.” If there is no such exception it will print the total sum of the array.
88+
89+
[Java Week 5:Q5](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-5/Question5_5.java)
90+
In the following program, there may be multiple exceptions. You have to complete the code using only one try-catch block to handle all the possible exceptions.
91+
92+
For example, if user’s input is 1, then it will throw and catch “java.lang.NullPointerException“.
93+
94+
## [WEEK 6](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/tree/WEEK-6)
95+
96+
[Java Week 6:Q1](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-6/Question61.java)
97+
Complete the code segment to print the following using the concept of extending the Thread class in Java:
98+
99+
-----------------OUTPUT-------------------
100+
101+
Thread is Running.
102+
103+
104+
[Java Week 6:Q2](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-6/Question62.java)
105+
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,
106+
107+
[Java Week 6:Q3](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-6/Question63.java)
108+
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.
109+
110+
[Java Week 6:Q4](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-6/Question64.java)
111+
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 some numbers. Do the necessary use of 'synchronized' keyword, so that, the program prints the output in the following order:
112+
113+
-----------------OUTPUT-------------------
114+
115+
5
116+
117+
10
118+
119+
15
120+
121+
20
122+
123+
25
124+
125+
100
77126

78-
## [WEEK 6](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/tree/WEEK-1)
127+
200
79128

80-
## [WEEK 7](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/tree/WEEK-1)
129+
300
130+
131+
400
132+
133+
500
134+
135+
136+
[Java Week 6:Q5](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-6/Question65.java)
137+
Add necessary codes to print the following:
138+
139+
-----------------OUTPUT-------------------
140+
141+
Name of thread 't':Thread-0
142+
143+
New name of thread 't':NPTEL
144+
145+
Thread is running.
146+
147+
## [WEEK 7](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/tree/WEEK-7)
148+
149+
[Java Week 7:Q1]()
150+
151+
[Java Week 7:Q2]()
152+
153+
[Java Week 7:Q3]()
154+
155+
[Java Week 7:Q4]()
156+
157+
[Java Week 7:Q5]()
158+
159+
160+
## [WEEK 8](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/tree/WEEK-8)
161+
162+
[Java Week 8:Q1]()
163+
164+
[Java Week 8:Q2]()
165+
166+
[Java Week 8:Q3]()
167+
168+
[Java Week 8:Q4]()
81169

82-
## [WEEK 8](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/tree/WEEK-1)
170+
[Java Week 8:Q5]()

0 commit comments

Comments
 (0)