Mock Test 1
Mock Test 1
Computer Science
FM: 35
Time: 1 hr. 30 minutes
Answer the following questions. The number within brackets beside every section
represents the concerned score.
Section A (7 x 1 = 7 marks)
7. Write the statement in Java to extract the word “NATION” from the word “ASSASINATION”.
Section B (4 x 2 = 8 marks)
9. The following function Check() is a part of some class. What will the function Check()
return when the values of both ‘m’ and ‘n’ is equal to 5? Show the dry run/working.
11.
P
B R
S T U V
X Y
Observe the above tree and write the Pre-order and In-order traversal sequences.
Section C (4 x 5 = 20 marks)
12. Write a program in Java to accept some word and check if it is a palindrome. 4
13. Write a program in Java to take a positive integer ‘n’ as input to find out all the
Pythagorean triplets <a, b, c> such that a<b<c and a2 + b2 = c2, within 1 to ‘n’. 6
14.Find output: 4
class Q1{
15. Write a program in Java to accept a square matrix A of order ‘n’, to be taken as input
and to generate a symmetric matrix, using A. 6