Please scroll down for latest Programs. 👇
Week 9 : Programming Assignment 1
Problem statement:
Complete the code to develop a BASIC CALCULATOR that can perform operations like Addition, Subtraction, Multiplication and Division.
Note the following points carefully:
1. Use only double datatype to store calculated numeric values.
2. Assume input to be of integer datatype.
3. The output should be rounded using Math.round() method.
4. Take care of the spaces during formatting output (e.g., single space each before and after =).
5. The calculator should be able to perform required operations on a minimum of two operands as shown in the below example:
Input:
5+6
Output:
5+6 = 11
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 5+6 | 5+6 = 11 | 5+6 = 11 | Passed |
Week 9 : Programming Assignment 2
Complete the code to develop an ADVANCED CALCULATOR that emulates all the functions of the GUI Calculator as shown in the image.
Note the following points carefully:
1. Use only double datatype to store all numeric values.
2. Each button on the calculator should be operated by typing the characters from 'a' to 'p'.
3. To calculate 25-6, User should input fjhkc (where, f for 2, j for 5, h for '-', k for 6 and c for '=' ).
3. You may use the already defined function gui_map(char).
4. Without '=', operations won't give output as shown in Input_2 and Output_2 example below.
5. The calculator should be able to perform required operations on two operands as shown in the below example:
Input_1:
klgc
Output_1:
18.0
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | klgc | 18.0 | 18.0 | Passed |
Week 9 : Programming Assignment 3
Complete the code to perform a 45 degree anti clock wise rotation with respect to the center of a 5 × 5 2D Array as shown below:
INPUT:
00100
00100
11111
00100
00100
OUTPUT:
10001
01010
00100
01010
10001
Note the following points carefully:
1. Here, instead of 0 and 1 any character may be given.
2. The input and output array size must be of dimension 5 × 5 and nothing else.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 00100
00100
11111
00100
00100 | 10001\n
01010\n
00100\n
01010\n
10001 | 10001\n
01010\n
00100\n
01010\n
10001\n
| Passed after ignoring Presentation Error |
Week 9 : Programming Assignment 4
Problem statement:
A program needs to be developed which can mirror reflect any 5 × 5 2D character array into its side-by-side reflection. Write suitable code to achieve this transformation as shown below:
INPUT: OUTPUT:
OOXOO OOXOO
OOXOO OOXOO
XXXOO OOXXX
OOOOO OOOOO
XOABC CBAOX
Note the following points carefully:
1. Here, instead of X and O any character may be present.
2. The input and output array size must be of dimension 5 × 5 and nothing else.
3. Only side-by-side reflection should be performed i.e. ABC || CBA.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | OOXOO
OOXOO
XXXOO
OOOOO
XOABC | OOXOO\n
OOXOO\n
OOXXX\n
OOOOO\n
CBAOX | OOXOO\n
OOXOO\n
OOXXX\n
OOOOO\n
CBAOX\n
| Passed after ignoring Presentation Error |
Week 9 : Programming Assignment 5
Write suitable code to develop a 2D Flip-Flop Array with dimension 5 × 5, which replaces all input elements with values 0 by 1 and 1 by 0. An example is shown below:
INPUT:
00001
00001
00001
00001
00001
OUTPUT:
11110
11110
11110
11110
11110
Note the following points carefully:
1. Here, the input must contain only 0 and 1.
2. The input and output array size must be of dimension 5 × 5.
3. Flip-Flop: If 0 then 1 and vice-versa.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 00001
00001
00001
00001
00001 | 11110\n
11110\n
11110\n
11110\n
11110 | 11110\n
11110\n
11110\n
11110\n
11110\n
| Passed after ignoring Presentation Error |
Week 10 : Programming Assignment 1
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | true | true | Passed |
Week 10 : Programming Assignment 2
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 0 | true | true | Passed |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 10 : Programming Assignment 3
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | true | true | Passed |
Week 10 : Programming Assignment 4
Complete the code segment to create a new table named ‘PLAYERS’ in SQL database using the following information.
Column | UID | First_Name | Last_Name | Age |
Type | Integer | Varchar (45) | Varchar (45) | Integer |
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | No. of columns : 4\n
Column 1 Name: UID\n
Column 1 Type : INT\n
Column 2 Name: First_Name\n
Column 2 Type : VARCHAR\n
Column 3 Name: Last_Name\n
Column 3 Type : VARCHAR\n
Column 4 Name: Age\n
Column 5 Type : INT | No. of columns : 4\n
Column 1 Name: UID\n
Column 1 Type : INT\n
Column 2 Name: First_Name\n
Column 2 Type : VARCHAR\n
Column 3 Name: Last_Name\n
Column 3 Type : VARCHAR\n
Column 4 Name: Age\n
Column 5 Type : INT\n
| Passed after ignoring Presentation Error |
Week 10 : Programming Assignment 5
Complete the code segment to rename an already created table named ‘PLAYERS’ into ‘SPORTS’.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | No. of columns : 4\n
Column 1 Name: UID\n
Column 1 Type : INT\n
Column 2 Name: First_Name\n
Column 2 Type : VARCHAR\n
Column 3 Name: Last_Name\n
Column 3 Type : VARCHAR\n
Column 4 Name: Age\n
Column 5 Type : INT | No. of columns : 4\n
Column 1 Name: UID\n
Column 1 Type : INT\n
Column 2 Name: First_Name\n
Column 2 Type : VARCHAR\n
Column 3 Name: Last_Name\n
Column 3 Type : VARCHAR\n
Column 4 Name: Age\n
Column 5 Type : INT\n
| Passed after ignoring Presentation Error |
Week 11 : Programming Assignment 1
Complete the code segment to insert the following data using prepared statement in the existing table ‘PLAYERS’.
Column | UID | First_Name | Last_Name | Age |
Row 1 | 1 | Ram | Gopal | 26 |
Row 2 | 2 | John | Mayer | 22 |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 11 : Programming Assignment 2
Write the required code in order to update the following data in the table ‘PLAYERS’.
Column | UID | First_Name | Last_Name | Age |
From | 1 | Ram | Gopal | 26 |
To | 1 | Rama | Gopala | 24 |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 11 : Programming Assignment 3
Write the appropriate code in order to delete the following data in the table ‘PLAYERS’.
Column | UID | First_Name | Last_Name | Age |
Delete | 1 | Rama | Gopala | 24 |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 11 : Programming Assignment 4
Complete the following program to calculate the average age of the players in the table ‘PLAYERS’.
Structure of Table 'PLAYERS' is given below:
Column | UID | First_Name | Last_Name | Age |
Type | Integer | Varchar (45) | Varchar (45) | Integer |
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 11 : Programming Assignment 5
Private Test cases used for Evaluation | Status |
Test Case 1 | Passed |
Week 12 : Programming Assignment 1
Complete the code to develop an extended version of the ADVANCED CALCULATOR with added special functions that emulates all the functions of the GUI Calculator as shown in the image.
Note the following points carefully:
1. Use only double datatype to store all numeric values.
2. Each button on the calculator should be operated by typing the characters from 'a' to 't'.
3. You may use the already defined function gui_map(char).
4. Use predefined methods from java.lang.Math class wherever applicable.
5. Without '=' binary operations won't give output as shown in Input_3 and Output_3 example below.
5. The calculator should be able to perform required operations on one or two operands as shown in the below example:
Input_1:
okhid
Output_1:
100.0
Input_2:
ia
Output_2:
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | okhid | 100.0 | 100.0 | Passed |
Test Case 2 | ia | 2.0 | 2.0 | Passed |
Week 12 : Programming Assignment 2
A partial code fragment is given. The URL class object is created in try block.You should write appropriate method( ) to print the protocol name and host name from the given url string.
For example:
https://www.xyz.com:1080/index.htm
protocol://host:port/filename
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | Protocol: http\n
Host Name: www.Nptel.com | Protocol: http\n
Host Name: www.Nptel.com | Passed |
Week 12 : Programming Assignment 3
Write a program to create a record by taking inputs using Scanner class as first name as string ,last name as string ,roll number as integer ,subject1 mark as float,subject2 mark as float. Your program should print in the format
"name rollnumber avgmark".
For example:
input:
ram
das
123
25.5
24.5
output:
ramdas 123 25.0
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | ram
das
123
25.5
24.5 | ramdas 123 25.0 | ramdas 123 25.0\n
| Passed after ignoring Presentation Error |
Week 12 : Programming Assignment 4
A program code is given to call the parent class static method and instance method in derive class without creating object of parent class. You should write the appropriate code so that the program print the contents of static method() and instance method () of parent class.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | NA | The instance method.\n
The static method. | The instance method.\n
The static method.\n
| Passed after ignoring Presentation Error |
Test Case 2 | NA | The instance method.\n
The static method. | The instance method.\n
The static method.\n
| Passed after ignoring Presentation Error |
Week 12 : Programming Assignment 5
Write a recursive function to print the sum of first n odd integer numbers. The recursive function should have the prototype
" int sum_odd_n(int n) ".
For example :
input : 5
output: 25
input : 6
output : 36
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 5 | 25 | 25\n
| Passed after ignoring Presentation Error |
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.