Skip to content

Commit 4070b8d

Browse files
Index
Week 8 Update
1 parent 2bb52c7 commit 4070b8d

File tree

1 file changed

+107
-42
lines changed

1 file changed

+107
-42
lines changed

README.md

Lines changed: 107 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -38,41 +38,34 @@
3838
[Java Week 3:Q4](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-3/Test3.java) This program to exercise the call of static and non-static methods. A partial code is given defining two methods, namely sum( ) and multiply ( ). You have to call these methods to find the sum and product of two numbers.
3939

4040
[Java Week 3:Q5](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-3/Question3.java) To swap two numbers using call by object reference.
41-
42-
41+
42+
4343
## [WEEK 4](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/tree/WEEK-4)
4444

4545
[Java Week 4:Q1](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-4/Question41.java) To execute the following program successfully. You should import the correct package(s) and/or class(s) to complete the code.
4646

4747
[Java Week 4:Q2](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-4/Question42.java) To print the current year.
4848

4949
[Java Week 4:Q3](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-4/Question43.java) The program in this assignment is attempted to print the following output:
50-
51-
-----------------OUTPUT-------------------
52-
50+
51+
```text
52+
-----------------OUTPUT-------------------
5353
This is large
54-
5554
This is medium
56-
5755
This is small
58-
5956
This is extra-large
60-
61-
-----------------OUTPUT-------------------
62-
57+
------------------------------------------
58+
```
6359
[Java Week 4:Q4](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-4/Question44.java) To call the default method in the interface First and Second.
6460

6561
[Java Week 4:Q5](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-4/Question45.java) To print the following output.
6662

67-
-----------------OUTPUT-------------------
68-
63+
```text
64+
-----------------OUTPUT--------------
6965
Circle: This is Shape1
70-
7166
Circle: This is Shape2
72-
73-
-----------------OUTPUT--------------------
74-
75-
67+
-------------------------------------
68+
```
7669

7770
## [WEEK 5](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/tree/WEEK-5)
7871

@@ -98,10 +91,10 @@ For example, if user’s input is 1, then it will throw and catch “java.lang.N
9891
[Java Week 6:Q1](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-6/Question61.java)
9992
Complete the code segment to print the following using the concept of extending the Thread class in Java:
10093

94+
```text
10195
-----------------OUTPUT-------------------
102-
10396
Thread is Running.
104-
97+
```
10598

10699
[Java Week 6:Q2](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-6/Question62.java)
107100
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,
@@ -111,40 +104,30 @@ Thread is Running.
111104

112105
[Java Week 6:Q4](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-6/Question64.java)
113106
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:
114-
107+
108+
```text
115109
-----------------OUTPUT-------------------
116-
117110
5
118-
119111
10
120-
121112
15
122-
123113
20
124-
125114
25
126-
127115
100
128-
129116
200
130-
131117
300
132-
133118
400
134-
135119
500
136-
120+
```
137121

138122
[Java Week 6:Q5](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-6/Question65.java)
139123
Add necessary codes to print the following:
140-
124+
125+
```text
141126
-----------------OUTPUT-------------------
142-
143127
Name of thread 't':Thread-0
144-
145128
New name of thread 't':NPTEL
146-
147129
Thread is running.
130+
```
148131

149132
## [WEEK 7](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/tree/WEEK-7)
150133

@@ -159,13 +142,95 @@ Complete the code segment to catch the exception in the following, if any. On th
159142

160143
[Java Week 7:Q5](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-7/Question5.java) A string "s1" is already initialized. You have to read the index "n" from the keyboard. Complete the code segment to catch the exception in the following, if any. On the occurrence of such an exception, your program should print “exception occur” .If there is no such exception, your program should replace the char "a" at the index value "n" of the "s1" ,then it will print the modified string.
161144

145+
## [WEEK 8](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/tree/WEEK-8)
146+
147+
[Java Week 8:Q1](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-8/Pattern1.java) Write a program which will print a pyramid of "*" 's of height "n" and print the number of "*" 's in the pyramid.
148+
```text
149+
For example:
162150
163-
## [WEEK 8](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/tree/WEEK-8)
151+
input : 5
152+
output:
164153
165-
## [WEEK 9](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/tree/WEEK-9)
154+
*
155+
* * *
156+
* * * * *
157+
* * * * * * *
158+
* * * * * * * * *
159+
25
160+
```
166161

167-
## [WEEK 10](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/tree/WEEK-10)
162+
[Java Week 8:Q2](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-8/Pattern2.java) Write a program which will print a pascal pyramid of "*" 's of height "l" .
163+
```text
164+
For example:
168165
169-
## [WEEK 11](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/tree/WEEK-11)
170-
171-
## [WEEK 12](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/tree/WEEK-12)
166+
input: 8
167+
168+
output :
169+
*
170+
* *
171+
* * *
172+
* * * *
173+
* * * * *
174+
* * * * * *
175+
* * * * * * *
176+
* * * * * * * *
177+
```
178+
179+
[Java Week 8:Q3](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-8/Pattern3.java) Write a program which will print a pyramid of "numbers" 's of height "n" and print the sum of all number's in the pyramid.
180+
```text
181+
For example:
182+
183+
input: 5
184+
185+
output:
186+
187+
1
188+
1 2 3
189+
1 2 3 4 5
190+
1 2 3 4 5 6 7
191+
1 2 3 4 5 6 7 8 9
192+
95
193+
```
194+
195+
[Java Week 8:Q4](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-8/Pattern4.java) Write a program to print symmetric Pascal's triangle of "*" 's of height "l" of odd length . If input "l" is even then your program will print "Invalid line number".
196+
```text
197+
For example:
198+
199+
input : 5
200+
201+
output:
202+
*
203+
* *
204+
* * *
205+
* *
206+
*
207+
208+
input : 6
209+
210+
output:
211+
212+
Invalid line number
213+
```
214+
215+
[Java Week 8:Q5](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-8/Pattern5.java) Write a program to display any digit(n) from 0-9 using "7 segment display".
216+
217+
```text
218+
219+
For example:
220+
221+
input : 5
222+
223+
output :
224+
_
225+
|_
226+
_|
227+
228+
229+
input : 4
230+
231+
output :
232+
233+
|_|
234+
|
235+
236+
```

0 commit comments

Comments
 (0)