GR 10 CTA QP Sample Paper
GR 10 CTA QP Sample Paper
Sample Paper
Grade: X Max. Marks : 100
Date:dd/mm/yyyy Time : 2 hrs
INSTRUCTIONS:
1
(iii) Which of the following is called a factory of objects?
(a) Function
(b) Class
(c) Package
(d) String
2
(ix) Choose the java statement to create an object named ball of the class
named Cricket.
(a) Cricket ball=new Cricket(System.in);
(b) ball Cricket=new Cricket();
(c) Cricket ball=new Cricket();
(d) ball Cricket=new Cricket(System.in);
(x) Give the function prototype of a function fun with int a and char b as
parameters and no return type.
(a) void fun(int a, char b)
(b) int fun(int a, char b)
(c) char fun(int a, char b)
(d) void fun()
(xi) Which of the following is not an example of composite data type? [2]
(a) String
(b) class
(c) Array
(d) long
3
(xiv) Which of the following is not a separator in java?
(a) (
(b) +
(c) }
(d) ;
4
(xvii) Math.sqrt() is a type of function.
(a) Inbuilt
(b) User defined
(c) Both (a) and (b)
(d) None of the above
(xviii) In this type of function calling, the value of actual parameter is copied
to the formal parameter.
(a) Call by Reference
(b) Call by value
(c) Inbuilt
(d) User defined
(xix) The automatic conversion that the Java compiler makes between the
primitive types and their corresponding object wrapper classes is called
as
(a) Autoboxing
(b) Unboxing
(c) Implicit
(d) Explicit
(xx) What will be the output for the following program segment?
String s="malayalam";
System.out.println(s.substring(0,2)+s.substring(4,6));
(a) yalam
(b) malyal
(c) malay
(d) maya
Q. 2
[20]
(i) What is a JVM? [2]
(ii) What are comments? [2]
Which of the following are valid comments?
(i) /*comment*/ (ii)/*comment (iii) //comment (iv) */comment*/
5
(iii) State one similarity and one difference between while and for loop. [2]
(iv) Write the output of the following program: [2]
class Design
{
public void main ()
{
char ch='M';
for (int i=0; i<3; i++)
{
for (int j=0; j<=i; j++)
{
System.out.print(ch);
ch++;
}
System.out.println();
}
}
}
(v) State the values for x and y [2]
int c=900, n=2000;
int x=0, y=0;
x= n+(c>2550? 1350:1500);
y=n+c>2550?1350:1500;
System.out.println("x="+x);
System.out.println("y="+y);
(vi) What will be the result stored in x after evaluating the following [2]
expression:
int x=4;
x+=(x++)+(++x)+x;
(vii) Name the following: [2]
(i) This access specifier allows the member variables and functions
to be accessed only in the class.
(ii) This type of variable is also called as the class variable.
6
(viii) State the purpose and return data type of the following String [2]
functions:
(i) indexOf( )
(ii) compareTo( )
(ix) Differentiate between isUpperCase() and toUpperCase() [2]
(x) How many memory bytes will be occupied by the following array? [2]
float n[8];
long x[10];
7
(iv) void display() To display the name and price of the book
after discount.
Write a main method to create an object of the class and call the above
member methods.
Q. 4 Write a program to input a number and print whether the number is a [15]
special number or not. (A number is said to be a special number, if the
sum of the factorial of the digits of the number is same as the original
number).
For example: 145 is a special number, because
1!+4!+5!=1+24+120=145
(where ! stands for the factorial of the number and the factorial value of
a number is the product of all integers from 1 to that number, example
5!=1*2*3*4*5=120)
Q. 6 [15]
Write a program in java to store the numbers in a 4*4 matrix in DDA.
Arrange the numbers of each row in ascending order and display
the result.
8
Q. 7 Write a program to accept a word and convert it into lowercase [15]
if it is in uppercase, and display the new word by replacing only
the vowels with the character following it.
Example:
Sample Input: computer
Sample Output: cpmpvtfr
Q. 8 Write a Program to accept the year of graduation from school [15]
as an integer value from the user. Using Binary search
technique on the sorted array of integers given below, output
the message "Record exists" if the value input is located in the
array.
If not, output the message "Record does not exist".
{1982, 1987, 1993, 1996, 1999, 2003, 2006, 2007, 2009, 2010}
*****