W9_Programming_Qs.1
Due on 2023-09-28, 23:59 IST
Consider the following program that finds the minimum element in an array. Fill in the blanks
as per the instructions given below:
• Fill in the blank at LINE-1 with appropriate template declaration.
• Fill in the blanks at LINE-2 and LINE-3 with appropriate conditional statement.
The program must satisfy the given test cases.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 5
50 27 10 70 23 | 10 | 10 | Passed |
Test Case 2 | 6
94 5 22 45 32 1 | 1 | 1 | Passed |
W9_Programming_Qs.2
Due on 2023-09-28, 23:59 IST
Consider the following program that takes inputs a lower limit (l) and an upper limit (u) of
a vector. If all the elements of the input vector are within the given lower and upper limits,
the program prints "all in [l, u]". Otherwise, the program prints the first element of the vector
which is not within the given limits. Fill in the blanks as per the instructions given below:
• at LINE-1 with appropriate header to overload function operator,
• at LINE-2 with appropriate template definition,
• at LINE-3 with appropriate condition,
such that the program will satisfy the given test cases.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 10 100 | all in [10, 100] | all in [10, 100] | Passed |
Test Case 2 | 10 70 | 90 is the first element not in [10, 70] | 90 is the first element not in [10, 70] | Passed |
W9_Programming_Qs.3
Due on 2023-09-28, 23:59 IST
Consider the following program, which computes the frequency of occurrence (histogram) of
each integer in a given vector. Fill in the blanks as per the instructions given below:
• at LINE-1 with appropriate statement to iterate over the given vector v,
• at LINE-2 with appropriate statement to iterate over the given map hi,
such that it will satisfy the given test cases.
Public Test Cases | Input | Expected Output | Actual Output | Status |
---|---|---|---|---|
Test Case 1 | 9 4 5 3 4 6 7 4 3 5 | 3: 2, 4: 3, 5: 2, 6: 1, 7: 1, 9: 1, | 3: 2, 4: 3, 5: 2, 6: 1, 7: 1, 9: 1, | Passed after ignoring Presentation Error |
Test Case 2 | 6 6 7 3 4 5 6 5 4 7 | 3: 1, 4: 2, 5: 2, 6: 3, 7: 2, | 3: 1, 4: 2, 5: 2, 6: 3, 7: 2, | Passed after ignoring Presentation Error |
NPTEL Programming in Modern C++ Programming Assignment Week-9 Sept-2023 Swayam
netaji gandi
Thursday, September 28, 2023