1.

Structures are very useful when we want to create Linked Lists and Trees. Here we will learn to create a Linked List struct.

Input Format:
The first line of testcase contains T denoting the number of testcases. T testcases follow. Each testcase contains two lines of input. The first line contains N denoting the number of nodes of the linked list. The second line contains the elements of the linked list.

Output Format:
For each testcase, in a new line, print the length of the linked list.

Your Task:
Since this is a function problem, you don't need to take any input. Just complete the provided struct. All the other functions of the linked-list are already implemented.

Constraints:
1 <= T <= 100
1 <= N <= 100

Examples:
Input:

1
5
1 2 3 4 5
Output:
5

Explanation:
Testcase1:

1->2->3->4->5->NULL is the linked list formed. The length is 5

2.

This is a functional problem i.e. partial code is already done for you, invest time to study the locked code and complete the solution accordingly.

In this problem, you need to add 2 given complex numbers and print the resulting complex number using '+' operator.

Implement a class named complex containing data members as real and imaginary part of the complex number and the following function:

  • void display()
  • constructor to assign values to the complex number.
  • operator function to add 2 numbers

Input:

First line of the input contains the number of test cases and each test case contains 4 space separated integer values representing the real and imaginary part of 2 complex numbers ( Real1 imaginary 1   real2 imaginary2 )
Output:

The output to each test case should be a single line representing the resulting complex number from the addition of given complex numbers. In the given format

real + imaginary_i

for eg:  2 +3i
Constraints:

1 <= Test case <= 100
Example:

Input:

2

3 6 -1 4

2 2 -1 -1

Output:

2 + 10i
1 + 1i

3.

Create class named Cuboid with fields length,width and height. Calculate volume of the cuboid.
Class Cuboid contains following functions:
1. set_height(int l): sets the length of the cuboid.
2. set_width(int w): sets width of the cuboid.
3. set_height(int h): sets height of the cuboid.
4.volume(): Prints the volume of the cuboid.

Input:
The first line contains an integer T, the number of test cases. For each test case, three integers are given.

Output:
For each test case, the output is the volume of the cuboid.

User Task:
Since this is a functional problem you don't have to worry about input, you just have to complete the functions given set_height(), set_width(), set_height() and volume().

Constraints:
1 <= T <= 100
1 <= l, w, h <= 103

Example:
Input

2
10 5 7
11 9 4

Output:
350
396

4.

Ankit is a very competitive person and always tries to compare him to other. He has got 5 subjects in his course and he wants to make a list of total marks and average marks of the students in his class with their roll numbers. He wants to use the concept of multi-level inheritance doing this. Help him achieve the required goal.   

Student class is already been created.

Create 2 classes:

  • Test: containing the marks of a student in 5 subjects inheriting class student ( having roll number of the student).
  • Result: containing the function Display() to compute the total and average and then displaying the output as Roll number, total and average which are space separated.

Input:

Most of the input is handled for you by the locked code in the editor.

  • The first line will contain the number of test cases(number of students)
  • Each test case has roll number of student in the first line followed by 5 space separated floating numbers in the second line.

Output:

For each test case or student, the output should consist of 3 space-separated values- Roll number, total marks, average marks 

Constraints: 

1 < T <= 100

1 < n < 100

0 <= marks <= 100
 

Example:

Input:

3
1
10 10 10 10 10
2
8 8 8 8 8 

7 7 7 7 7

Output:

1 50 10
2 40 8
3 35 7

 

5.

Create class named CollegeCourse with fields courseID, grade, credits, gradePoints and honorPoints. Calculate honorpoints as the product of gradepoints and credits. GradePoints are calculated as (A-10),(B-9),(C-8),(D-7),(E-6) & (F-5).
Class CollegeCourse contains following functions:
1. set_CourseID( string CID): sets courseID
2. set_Grade(char g): sets grade equal to g
3. set_Credit(int cr): sets credits equal to cr 
4.calculateGradePoints(char g): returns gradePoint(int)
5. calculateHonorPoints(int gp,int cr): return honorPoint (float)
6. display(): prints gradePoint and honorPoint

Input:
The first line contains an integer T, the number of test cases. For each test case, there is a string CID, denoting Course ID, a character g, denoting the grade and an integer cr, denoting the credits of the course.

Output:
For each test case, the output is the gradePoints & the honorPoints of that course.

Constraints:
1<=T<=100
1<=CID.length()<=100
'A'<=g<='F'
1<=cr<=4
Note: Grades are not case sensitive.

Example:
Input

2
CSN-206 A 4
ECE-500 d 3
Output
10 40
7 21