Raptor Tasks
Raptor Tasks
Task 1
Input
Test case Output
A B
1 20 10 30
2 30 20 50
3 40 20 60
Task 2
1 2 4
2 6 36
3 5 25
Task 3
Write a program to read the name and print in the following format
Additional Task1
Write a program to compute division by reading dividend and divisor as input and display quotient
Input
Test case Output
dividend divisor
1 20 10 2
2 72 7 10.2857
3 5 20 0.25
Additional Task2
e.g: 53 = 5 x 5 x 5
Input
Test case Output
base power
1 5 3 125
2 2 4 16
3 6 8 1679616
Additional Task3
1 5.23423 5
2 1.8912 1
3 -1.643 -2
SECTION2
Task 1
Write a program to find the bigger of 2 integers A and B.
Input
Test case Output
A B
1 4 19 19
Task 2
1 4 Even
3 57 Odd
Task3
Write a program that takes three integers A, B, and C as input. The program should return “Possible”
if it is possible to add two of the integers to get the third one and “Impossible” otherwise
Input
Test case Output
A B C
1 1 2 3 Possible
2 3 7 4 Possible
3 2 3 9 Impossible
Additional Task 1
Input
Test case Output
A B
1 11 12 Large
2 7 6 Medium
3 7 2 Small
Additional Task 2
Write a program that takes two integers A and B and checks whether both are “double digit” numbers.
If both are not double digit numbers then return “False” and end the program. If both are double digit
numbers then return "Odd Sum", if sum of A and B is odd and "Even Sum" otherwise.
Input
Test case Output
A B
1 11 100 False
2 12 10 Even Sum
3 30 21 Odd Sum
Additional Task 3
Marks Grade
You will need to read the marks from the user and display the appropriate grade. Note: Marks can be
between 0 and 100 (both inclusive) only.
1 82 Good
3 30 Not satisfactory
Additional Task 4
You will need to read two integers and perform the following operations on them based on the user
input (1 - addition, 2 - subtraction, 3- multiplication, 4 - division).
Test
Input
case
Output
A B Operation
1 25 43 1 68
2 32 23 2 9
3 30 3 3 90
0 4 Not
4 56
possible
5 22 11 4 2
SECTION3
Task 1
Write a program that asks the user to input a non-negative number N and prints the first N natural
numbers.
1 2 [ 1 2]
2 4 [1 2 3 4]
3 7 [ 1 2 3 4 5 6 7]
Task 2
1 4 [ 2 4 6 8]
2 3 [ 2 4 6]
3 1 [2]
Task 3
Write a program to check whether a given positive integer A is a prime number or not.
1 11 Prime
2 82 Not a Prime
3 17 Prime
Additional Task 1
Write a program that takes as input three integers, the number whose multiples you need to find, and
the other two numbers, the lower and upper limit between which you need to find the multiples. All
three inputs should be integers.
Input
Test case Output
N Lower limit Upper limit
2 -4 -9 3 -8, -4, 0
Additional Task 2
Write a program to print the multiplication table of an integer (X) till a certain limit (number and limit
to be specified by user). By default the multiplication table starts with 1.
Input
Test case Output
X Limit
3 * 1 = 3
3 * 2 = 6
3 * 3 = 9
3 * 4 = 12
3 * 5 = 15
1 3 10
3 * 6 = 18
3 * 7 = 21
3 * 8 = 24
3 * 9 = 27
3 * 10= 30
5 * 1 = 5
5 * 2 = 10
2 5 5 5 * 3 = 15
5 * 4 = 20
5 * 5 = 25
Additional Task 3
1 2 3
1 3 4 5
1 2
2 2
3
1 2 3 4 5
6 7 8 9
3 5 10 11 12
13 14
15
Additional Task 4
Write a program to find out the square root of a number using only loops and conditions. Do not use in
built functions like sqrt or operations like ** and ^.
In other words, given a positive integer 'x', find the largest positive integer 'n' such that n^2 <= x.
1 4 2
2 7 2.6458
3 20 4.4721
Additional Task 5
Write a program to find out if a given positive integer has digits in ascending order or descending
order. You will need to check this from the left most digit to the right most digit.
1 123 Ascending
2 986278 Arbitrary
3 987 Descending
Task 1
Input
Test case Output
A B
1 [-1 2 3 1 4] [2 2 2 2 2] [1 4 5 3 6]
2 [0 0 0 0 0] [1 2 3 4 5] [1 2 3 4 5]
3 [2 5 1 7 3] [3 2 1 -8 0] [5 7 2 -1 3]
Task 2
Write a program to reverse the order of any given integer array A of any size. (Do not use the another
array variable to store the values or just print it in reverse order)
Test case Input(A) Output
1 [1 2 3 4 5 6] [6 5 4 3 2 1]
2 [3 1 2] [2 1 3]
3 [10 1 9 7] [7 9 1 10]
Task 3
Write a program to add two 4X4 matrices A and B and store the result in matrix C.
Input
Test case Output (C)
A B
1 1 1 1
1 1 1 1
2 2 2 2
1 1 1 1 3 3 3 3
2 2 2 2
1 1 1 1 1 3 3 3 3
2 2 2 2
3 3 3 3
2222
3 3 3 3
1 3 3 2
3 1 2 3 -2 1 2 2 -1 4 5 4
3 2 1 3 2 2 3 2 5 3 5 5
2
2 3 3 1 2 2 4 -2 5 4 5 1
-6 2 2 -1 -4 5 5 0
Additional Task1
Write a program to read an integer array (of size 10) from the user. Now do the following operations on
the array (user needs to select one of these operations)
Input
Test case Output
Input Array operation
1 [2 4 5 1 3 8 2 7 6 9] 1 [2 4 5 1 3 8 2 7 6 9]
2 3 [5 1 3 7 9]
[2 4 5 1 3 8 2 7 6 9]
[2 4 5 1 3 8 2 7 6 9]
3 2 [9 6 7 2 8 3 1 5 4 2]
Additional Task2
Write a program to read an integer array, A, of size 5. You will now need to create another array O (of
size 5) which satisfies the following condition.
O[3] = A[1]*A[2]*A[4]*A[5]
1 [1 2 3 4 5] [120 60 40 30 24]
2 [2 3 1 2 1] [6 4 12 6 12]
Additional Task3
Write a program to read a 2-dimensional matrix of order 2x2 and perform the following operations on it
Hint: A = |a b|
|c d|
Transpose: AT = |a c|
|b d|
Determinant: |A| = a*d – b*c
Transpose: |2 1|
|2 3|
1 |3 4|
|1 4|
Determinant: 5
Transpose: |-2 5|
|-2 -3|
2 |-3 4|
|5 4|
Determinant: 7
Transpose: |4 1|
|4 -1|
3 |-1 0|
|1 0|
Determinant: 1
SECTION5
Task 1
Write a program that takes three string inputs S1 (your name), S2 (college name), and S3 (city) and
prints the strings separated by the delimiter comma (,).
Input
Test case Output
S1 (name) S2(College name) S3 (City name)
Task 2
Write a program that takes a string S1 of letters as input and converts the letters into upper case.
1 Abcdef ABCDEF
2 Hello, how are you? HELLO, HOW ARE YOU?
3 Alpha315ComeIn ALPHA315COMEIN
Task 3
Write a program that takes two string inputs S1, S2 and checks whether S2 is a substring of S1 or
not.
Input
Test case Output
S1 S2
1 ChanakyaPuri Chaya No
2 India In Yes
Additional Task1
1 Vikram Markiv
2 Program margorP
3 EnhanceEdu udEecnahnE
Additional Task2
2 Madam Palindrome
3 rotator Palindrome
Additional Task3
Write a program to check the order of two strings S1 and S2 in the dictionary i.e which of these strings
appear later in a dictionary.
Input
Test case Output
S1 S2
Additional Task4
Write a program that reads a large string (minimum length 50) and gives a count of the number of
vowels and consonants in that sentence.
Hint: Use ascii values and check that with vowels’ ascii values
Test
Input Output
case
String minimum
2 Welcome to CT
length should be 50
Additional Task5
Write a program that takes a string as input and displays the string after removing the repeated
characters. (Consider lower case character and upper case character is same eg: ‘A’ equals to ‘a’)
1 helloworld hewrd
2 Madam d
3 EnhanceEdu hacdu
SECTION6
Task 1
Write a program that takes an integer A as input and calls the function
Large (), if A > 100. This function prints the string “Large”.
Medium (), if 50 <= A <= 100. This function prints the string “Medium”.
1 120 Large
2 50 Medium
3 22 Small
Task 2
Write a program that sends two integers A and B as parameters to different functions below
Read the read the operation (1 for Summation, 2 for product and 3 for Difference of A and B) that
needs to be performed by calling the particular function. Use Procedures to solve the problem.
Input
Test case Output
A B Operation
1 5 8 1 13
2 6 2 3 4
3 20 4 2 80
Task3
Write a function to sort the elements in an array (of length 5). You should pass the unsorted array to
this function and the function should return a sorted array. Use Procedure to solve the problem
1 {2,1,3,4,5} 1,2,3,4,5
2 4,2,1,1,5 1,1,2,4,5
Additional Task1
Write a program that reads two strings as input and checks if the string in smaller length is a substring of
the larger string. Pass the two strings as inputs to a function checkSubString, which checks if the smaller
string is a substring of the larger one or not.
Input
Test case Output
String1 String2
Additional Task2
Write a program that reads a 3x3 matrix, “A” as input and performs the following actions on it
a. Transpose(A)
b. Determinant(A)
Ex: Transpose of 3X3 Matrix
Let Matric A= | a b c|
|d e f|
|g h i|
AT = |a d g|
|b e h|
|c f i|
Ex: Determinant of 3X3 Matrix
Let Matric A= | a b c|
|d e f|
|g h i|
|A| = a(ei-hf)+b(fg-di)+c(dh-eg)
Test case Input A Output
Transpose of matrix:
|1 2 3| |1 4 7|
1 |4 5 6| |2 5 8|
|7 8 9| |3 6 9|
Determinant of matrix: 0
Transpose of matrix:
|-1 5 -2| |-1 4 8|
2 |4 3 6| |5 3 2|
|8 2 -1| |-2 6 -1|
Determinant of matrix: 307
|3 4 4|
3 |4 e 5| Invalid Input
|2 1 6|
Additional Task3
Write a program that reads two 2x2 matrices, A and B, and perform the following functions on them
a. Addition(A, B) i.e. A + B
b. Subtraction(A, B) i.e. A - B
c. Multiplication(A, B) i.e. A * B
Ex:
A= | a b| B= | e f| A+B = |a+e b+f|
|c d| | g h| |c+g d+h|
A-B = |a-e b-f| A X B = | (a*e) + (b*g) (a*f) + (b*h) |
|c-g d-h| | (c*e) + (d*g) (c*f) + (d*h) |
Input
Test case Output
A B
Addition: |-1 8|
|5 0|
|2 3| |-3 5 | Subtraction: |5 -2|
1
|3 1| |2 -1| |1 2|
Multiplication: |0 7|
|-7 14|
|2 e| |-3 5 |
2 “Invalid input”
|3 1| |2 -1|
Additional Task4
Write a program that reads a string as input and performs the following functions based on the user
option to select the following function
3. substring(int start, int end) – Displays a substring from start position to end position in the string
Input
Test
Output
case Character Start
String User option End position
position position
Task 1
Given a positive integer N as user input, write a program to print the sum of the first N natural
numbers using recursion.
1 3 6
2 5 15
3 10 55
Task 2
Given a positive integer N as user input, write a program to print the sum of the cubes of the first N
natural numbers using recursion.
1 3 36
2 1 1
3 5 225
Task 3
Write a program to find whether the given number P is a prime number or not using recursion.
1 3 "Prime Number"
2 5 "Prime Number"
Additional Task1
Write a program that takes a string "Str1" as input and prints the reverse of it using recursion.
1 Arjuna anujrA
2 Ashoka akohsA
3 Reverse esreveR
Additional Task2
Input
Test case Output
size Array
1 5 {2, 3, 5, 1, 6} {1, 2, 3, 5, 6}
3 8 {2, 4, 2, 5, 6, 1, 3, 9} {1, 2, 2, 3, 4, 5, 6, 9}
Additional Task3
Write a program that print first 500 prime numbers using recursion.