Skip to content

Commit 2bb52c7

Browse files
Index
Week 8 Update
1 parent eb2ba7d commit 2bb52c7

File tree

1 file changed

+110
-32
lines changed

1 file changed

+110
-32
lines changed

docs/README.md

+110-32
Original file line numberDiff line numberDiff line change
@@ -47,30 +47,25 @@
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--------------------
67+
-------------------------------------
68+
```
7469

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

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

94+
```text
9995
-----------------OUTPUT-------------------
100-
10196
Thread is Running.
102-
97+
```
10398

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

110105
[Java Week 6:Q4](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-6/Question64.java)
111106
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-
107+
108+
```text
113109
-----------------OUTPUT-------------------
114-
115110
5
116-
117111
10
118-
119112
15
120-
121113
20
122-
123114
25
124-
125115
100
126-
127116
200
128-
129117
300
130-
131118
400
132-
133119
500
134-
120+
```
135121

136122
[Java Week 6:Q5](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-6/Question65.java)
137123
Add necessary codes to print the following:
138-
124+
125+
```text
139126
-----------------OUTPUT-------------------
140-
141127
Name of thread 't':Thread-0
142-
143128
New name of thread 't':NPTEL
144-
145129
Thread is running.
130+
```
146131

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

@@ -156,3 +141,96 @@ Complete the code segment to catch the exception in the following, if any. On th
156141
[Java Week 7:Q4](https://github.com/bkkothari2255/Programming_In_Java_NPTEL/blob/WEEK-7/Question4.java) The following program reads a string from the keyboard and is stored in the String variable "s1". You have to complete the program so that it should should print the number of vowels in s1 . If your input data doesn't have any vowel it will print "0".
157142

158143
[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.
144+
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:
150+
151+
input : 5
152+
output:
153+
154+
*
155+
* * *
156+
* * * * *
157+
* * * * * * *
158+
* * * * * * * * *
159+
25
160+
```
161+
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:
165+
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)