0% found this document useful (0 votes)
7 views3 pages

1st Mock Computer

Computer Practice Paper

Uploaded by

monidipag692
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views3 pages

1st Mock Computer

Computer Practice Paper

Uploaded by

monidipag692
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Time :2 hrs.

Class X Full Marks :100


Section – A
(Attempt all questions from this section)
Question 1 [20]
(i) Name the feature / elements of java depicted in the given picture

a) Data Abstraction b) Polymorphism c) Class & Objects d) A set of Animals


(ii) Java Interpretor which converts java byte code to machine code is known as
a) Library Class b)JVL c)JVM d)API
(iii) The conversion in which the lower data type value gets converted to its higher data type value
automatically is termed as :
a) Explicit type conversion b) Type Casting c) Swapping d) Coercion
(iv) _________ feature of OOP’s allows a class to use the properties and methods of another class
a) Polymorphism b) Encapsulation c) Abstraction d) Inheritance
(v) Function overloading is an approach of which principle of OOP’s
a) Inheritance b) Abstraction c) Polymorphism d)Overloading
(vi) The statement that converts the string object s = “400” to integer “s_int” is
a) S_int = Integer.parse(s); b) S_int = Integer.parseInt(s);
c) S_int = Integer.toString(s); d) S_int = Integer.parseint(s);
(vii) Given an array 2, 1, 9, 12, 14 what will be array like after 2 passes of Selection sort in descending order
a) 2,9,12,14,1 b) 14,12,9,1,2 c) 14,1,9,12,2 d) None of these
(viii) Choose the element at arr[0] [1] , arr[1][2] of
ntarr[ ] [ ] = {{3,4,5}, {6,7,8}, {1,2,3}};
a) 6, 2 b) 4, 2 c) 4, 8 d) 8, 4
(ix) Converting an object of a wrapper class (Integer) to its corresponding primitive type (int) is temed as
a) Autoboxing b)Corecion c) Unboxing d) None of these
(x) Statement encloses multiple lines within a pair of opening and closing curly brackets { }
a) Sequential b) Iteration Statement c) Compound Statement d) Jump Statement
(xi) switch ( x )
{
case 'a' : System.out.println("Discipline");
case 'b' : System.out.println ("Dedication"); break;
case 'c' : System.out.println("Commitment");
default :System.out.println("Success");
}
when x='A'
a) Discipline b) Dedication c) Success d) None of these

(xii) What will be the expression for


a) (Math.pow(a+b),n)/(Math.sqrt(3)+b) b) (Math.sqrt(a+b),n)/(Math.pow(3)+b)
c) (Math.sqrt(a+b),n)/(Math.rint(3)+b) d) None of these
(xiii) n=1000;
while (n>10)
{
n=n/10;
}
System.out.println(n);
How many time the loop is executed and what is the output?
a) Loop is executed 2 times and the output is 100 b) Loop is executed 3 times and the output is 10
c) Loop is executed 2 times and the output is 10. d) None of the above
(xiv) What will be the output of the following code snippet?
int a=15;
int b=25;
if ((a<b) || (a=5)>15)
system.out.println(a);
else
system.out.println(b);
a) Error b) 15 c) 25 d) No output
(xv) for (a=2; a<=8; a+=2)
{
for (b=1; b<=a; b++)
{
}
}
How many times the inner loop is executed ?
a) 2 b) 4 c) 6 d) 20
(xvi) Assertion (A) : Tokens are the series of character ending with delimiters. They are considered to be String
types and are manipulated through various methods available in the Scanner Class
Reason (R) : The Scanner class accepts the input in terms of Tokens.
Based on the above discussion, choose a n appropriate statement from the options given below:
a) Bothe Assertion (A) and Reason (R) are true and Reason (R) is the correct explanation of Assertion (A).
b) Bothe Assertion (A) and Reason (R) are true and Reason (R) is not the correct explanation of Assertion (A).
c) Assertion (A) is true but Reason (R) is false.
d) Assertion (A) is false but Reason (R) is true.
(xvii) Case Study based questions :
A loop based program snippet has a facility to terminate the loop even if the required iterations are not over. You can also
create a loop in which the execution repeats for the next iteration leaving the current iteration incomplete. Sometimes, you
need to design a loop that has endless number of iterations or without the block of statements whose execution need to be
iterated.
Based on the above discussion, answer the following questions :
i) Which statement is used to terminate the loop, if its iterations are not over ?
a) continue b) break c) skip d) jump
ii) Name the statement that returns to the execution of the next iteration of the loop if the current iteration is
incomplete.
a) continue b) repeat c) goto d) break
iii) which of the following is not an endless looping construct ?
a) for (i = -10 ; i >= 0 ; i + =2) b) for (i = 1 ; i >= -10 ; i++) c) for (i = 0 ; i <= 10;) d) for (; ;)
iv) A loop without the block of statements is called as :
a) Entry controlled loop b) exit controlled loop c) empty loop d) unknown iterative loop

Question 2 [20]
(i) Given a character array char arr[] ‘J’, ‘A’, ‘V’, ‘A’ ; and an integer b=2;
What will be the output of the below statements if they are executed one after the other :
a) System.out.println (arr[b++]); b) System.out.println (arr[b]++);
(ii) convert if to switch
{
if(n==1 || n==2)
System.out.println("Good");
else
if(n==3)
System.out.println("Fair");
else
System.out.println("Poor");
}
(iii) Rewrite the following program segment using while instead of for statement
int f = 1, i;
for (i = 1; i <= 5; i++)
{
f *= i;
System.out.println(f); }
(iv) Write a for loop statement that initializes a loop variable k as 50, decrement it by 1 in every pass and executesthe loop
body infinite number of times.
(v) What will be the output :
System.out.println(Math.ceil(20.001)); System.out.println(Math.floor(128.0));
System.out.println(Math.rint(25.49)); System.out.println(Math.abs(-12.75));
(vi) State the difference between if-else if and switch...case.
(vii) Name of the following:
a) A keyword used to call a package in the program. b) Any one reference data types.
(viii) What is the differentiate between Formal Parameter and Actual Parameter.
(ix) Write the prototype of a method that returns true / false and take two string as parameters.
(x) State the method that :
a) Converts a string to a primitive float data typeb) Determines if the specified character is an uppercase character

Section – B
All the programs should be written with Variable Description Table
(attempt any four questions from the section) 15 × 4 = 60
Q4. Write a program to store n number of state name and its capital in ascending order and then input a state
name and print its capital if it is in the list otherwise print the appropriate messageusing binary search.

Q5. An Abundant number is a number for which the sum of its proper factors is greater than the number itself.
Write a program to input a number and check and print whether it is an Abundant number or not.
Example:
Consider the number 12.
Factors of 12 = 1, 2, 3, 4, 6 Sum of factors = 1 + 2 + 3 + 4 + 6 = 16
As 16 > 12 so 12 is an Abundant number.

Q6. Design a class to overload a function volume() as follows :


i) Double volume (double r) with one double argument returns the volume of a sphere using the
formula volume = 4/3 πr2
ii) Double volumen (double r, double h) with two double argument, returns the volumen of a cone using the
formula volume = 1/3 πr2h
iii) Double volumen (double 1, double b, double h)) with three double argument, returns the
volumen of a cuboid using the formula volume = 1* b *h;
Write a main method to invoke the functions.

Q7. Write a program to input numbers into a 5×5 integer matrix and find it’s transpose. The transpose of a matrix is a new
matrix whose rows are the columns of the original. (This makes the columns of the new matrix the rows of the original). Here
is a matrix and its transpose:
Sample Input:
1 2 3
4 5 6
7 8 9
Sample Output:

1 4 7
2 5 8
3 6 9

Q8. Write a program to accept a list of 20 integers. Sort the first 10 numbers in ascending order and next the 10
numbers in descending order by using 'Bubble Sort' technique. Finally, print the complete list of integers.

Q9. Write a menu driven program to find the sum of the following series depending on the user choice.
1. 1234567
12345
123
1
2. To display the sum of the series given below:
1/1! + 3/3! + 5/5! + ..... + n/n!

You might also like