NPTEL » Programming In Java Jan 2023 NPTEL course
Please scroll down for latest Programs. 👇
Support me : Subscribe to the YouTube Channel : Swayam Solver
Week 1 : Programming Assignment 1
Complete the code segment to help Ragav , find the highest mark and average mark secured by him in "s" number of subjects.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 5
20 50 60 40 70 | 70\n
48.0 | 70\n
48.0 | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Test Case 2 | Passed |
Week 1 : Programming Assignment 2
Consider First n even numbers starting from zero(0).Complete the code segment to calculate sum of all the numbers divisible by 3 from 0 to n. Print the sum.
Example:
Input: n = 5
-------
0 2 4 6 8
Even number divisible by 3:0 6
sum:6
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 1 | 0 | 0 | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Test Case 2 | Passed |
Week 1: Programming Assignment 3
Complete the code segment to find the perimeter and area of a circle given a value of radius.
You should use Math.PI constant in your program. If radius is zero or less than zero then print " please enter non zero positive number ".
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 2.5 | 15.707963267948966\n
19.634954084936208 | 15.707963267948966\n
19.634954084936208 | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 1 : Programming Assignment 4
Complete the code segment to check whether the number is an Armstrong number or not.
Armstrong Number:
A positive number is called an Armstrong number if it is equal to the sum of cubes of its digits for example 153 = 13+53+33, 370, 371, 407, etc.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 203 | 0 | 0 | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Test Case 2 | Passed |
Week 1 : Programming Assignment 5
Complete the code segment to find the largest among three numbers x,y, and z. You should use if-then-else construct in Java.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | -4 -2 -3 | -2 | -2 | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Test Case 2 | Passed |
---------------------------------------------------------------------------------------------------------------------------------------------
Week 2 : Programming Assignment 1
Due on 2023-02-09, 23:59 ISTComplete the code segment to call the method print() of class School first and then call print() method of class Student.
NOTE: Don't provide any INPUT in Sample Test Cases
Public Test Cases Input Expected Output Actual Output Status Test Case 1 NA
Hi! I class SCHOOL.\n
Hi! I am class STUDENT
Hi! I class SCHOOL.\n
Hi! I am class STUDENT\n
Passed after ignoring Presentation Error
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | Hi! I class SCHOOL.\n
Hi! I am class STUDENT | Hi! I class SCHOOL.\n
Hi! I am class STUDENT\n
| Passed after ignoring Presentation Error |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 2 : Programming Assignment 2
Due on 2023-02-09, 23:59 ISTComplete the code segment to call the method print() of class given class Printer to print the following.
--------------------------------
Hi! I am class SCHOOLHi! I class STUDENT.
--------------------------------
NOTE: Don't provide any INPUT in Sample Test Cases
Public Test Cases Input Expected Output Actual Output Status Test Case 1 NA
Hi! I class SCHOOL.\n
Hi! I am class STUDENT
Hi! I class SCHOOL.\n
Hi! I am class STUDENT\n
Passed after ignoring Presentation Error
--------------------------------
--------------------------------
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | Hi! I class SCHOOL.\n
Hi! I am class STUDENT | Hi! I class SCHOOL.\n
Hi! I am class STUDENT\n
| Passed after ignoring Presentation Error |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 2 : Programming Assignment 3
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | Well Done! | Well Done! | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 2 : Programming Assignment 4
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | You got nothing.\n
You got 10 for an MCQ | You got nothing.\n
You got 10 for an MCQ | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 2 : Programming Assignment 5
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | NPTEL JAVA NPTEL | NPTEL JAVA NPTEL | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
--------------------------------------------------------------------------------------------------------------------------------------
Week 3 : Programming Assignment 1
Define a class Point with two fields x and y each of type double. Also, define a method distance(Point p1, Point p2) to calculate the distance between points p1 and p2 and return the value in double.
Complete the code segment given below. Use Math.sqrt( ) to calculate the square root.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 2.0 3.0
1.0 2.0 | 1.4142135623730951 | 1.4142135623730951 | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 3 : Programming Assignment 2
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. Complete the code segment as instructed.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 3 5 | 8\n
15 | 8\n
15 | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 3 : Programming Assignment 3
Complete the code segment to swap two numbers using call by object reference.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 15 20 | 20 15 | 20 15\n
| Passed after ignoring Presentation Error |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 3 : Programming Assignment 4
This program is related to the generation of Fibonacci numbers.>
For example: 0,1, 1,2, 3,5, 8, 13,… is a Fibonacci sequence where 13 is the 8th Fibonacci number.
A partial code is given and you have to complete the code as per the instruction given .
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 1 | 0 | 0\n
| Passed after ignoring Presentation Error |
Test Case 2 | 3 | 1 | 1\n
| Passed after ignoring Presentation Error |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Test Case 2 | Passed |
Week 3 : Programming Assignment 5
A class Shape is defined with two overloading constructors in it. Another class Test1 is partially defined which inherits the class Shape. The class Test1 should include two overloading constructors as appropriate for some object instantiation shown in main() method. You should define the constructors using the super class constructors. Also, override the method calculate( ) in Test1 to calculate the volume of a Shape.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 2.0 3.0 4.0 | 16.0\n
24.0 | 16.0\n
24.0\n
| Passed after ignoring Presentation Error |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
---------------------------------------------------------------------------------------------------------------
Week 4 : Programming Assignment 1
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NPTEL JAVA | Course: NPTEL JAVA\n
[Volvo, BMW, Ford, Mazda] | Course: NPTEL JAVA\n
[Volvo, BMW, Ford, Mazda]\n
| Passed after ignoring Presentation Error |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 4 : Programming Assignment 2
Note: In this program, you are not allowed to use any import statement. Use should use predefined class Calendar defined in java.util package.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | Current Year: 2023 | Current Year: 2023\n
| Passed after ignoring Presentation Error |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 4 : Programming Assignment 3
This is medium
This is large
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | This is small\n
This is medium\n
This is large\n
This is extra-large | This is small\n
This is medium\n
This is large\n
This is extra-large\n
| Passed after ignoring Presentation Error |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 4 : Programming Assignment 4
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | Default method implementation of Second interface.\n
Default method implementation of First interface. | Default method implementation of Second interface.\n
Default method implementation of First interface.\n
| Passed after ignoring Presentation Error |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 4 : Programming Assignment 5
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | Circle: This is Shape2\n
Circle: This is Shape1 | Circle: This is Shape2\n
Circle: This is Shape1\n
| Passed after ignoring Presentation Error |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
---------
Week 2 : Programming Assignment 1 and Week 2 : Programming Assignment 2 are Wrong
ReplyDeleteIt has been rectified.
DeleteThis comment has been removed by a blog administrator.
ReplyDeleteweek 5 assignment answers sir
ReplyDelete