0% found this document useful (0 votes)
3 views6 pages

Class Ix Revision Worksheet 1

The document is a revision worksheet for Class IX covering various programming concepts, primarily focusing on Java. It includes multiple-choice questions, identifier validation, data types, and operator precedence. The worksheet aims to test students' understanding of programming fundamentals and Java syntax.

Uploaded by

mansvi235
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)
3 views6 pages

Class Ix Revision Worksheet 1

The document is a revision worksheet for Class IX covering various programming concepts, primarily focusing on Java. It includes multiple-choice questions, identifier validation, data types, and operator precedence. The worksheet aims to test students' understanding of programming fundamentals and Java syntax.

Uploaded by

mansvi235
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/ 6

CLASS IX REVISION WORKSHEET 1

1. Give answer in one word [4]


i) Mechanism by which one class acquired the properties of another class.
ii) Mechanism that binds the data and function into a single unit.
iii) Mechanism by which you can send the same message to different objects.
iv) Mechanism representing essential features without including background details.
2. Write two differences between Procedure Oriented Programming and Object Oriented
Programming [2]
3. Explain with reason why the following identifiers are not valid: [3]
i) 20abc
ii) First name
iii) Total-marks
4. Identify the literals below [2]
i) ‘n’
ii) “n”
5. Which Example defined Non Primitive Data Types.
Int float String boolean
6. Which Java package includes the Math class ?
a) java.io b) java.util c) java.lang d) java.sys
7. Give output of Math.ceil (47.4) ?
a) 48.0 b) 48 c) 47.0 d) 47
8. Math.random() returns a double value r such that
a) 0.0< =r <1.0 b)0.0< r <=1.0 c) 0.0<= r <=1.0 d) 0.0< r <1.0
9. Which mathematical function in Java is used to find the cube root of a number ?
a) Math.sqrt() b) Math.cbrt() c) Math.round() d) Math.random()
10. Which of the following statement is used to perform the same task multiple times ?
a) for b) if c) else d) switch
11. How many times the following loop will execute ?
for( i=1; i<14; i++)
a) 14 b) 13 c) 12 d) 11
12. What will be output of Math.floor(3.4) + Math.pow(2,3)
a) 11 b) 11.0 c) 12.0 d) 10.0
What will be the output of following ?
int i,s=0;
for(i=1; i<=5; i++)
{ s = s + i; }// 0 +1+2+3+4+5
System.out.println(s);
a) 13 b) 14 c) 15 d) 16

13. Which Java package includes the Math class ?


a) java.io b) java.util c) java.lang d) java.sys
14. Give output of Math.floor (17.8) ?
a) 18.0 b) 18 c) 17.0 d) 17
15. Math.random() returns a double value r such that
a) 0.0< =r <1.0 b)0.0< r <=1.0 c) 0.0<= r <=1.0 d) 0.0< r <1.0
16. Which mathematical function in Java is used to find the square root of a number ?
a) Math.sqrt() b) Math.cbrt() c) Math.round() d) Math.random()
17. Which clause is mandatory in the switch statement ? [1]
a) break b) continue c) case d) default
18. Which of the following causes a fall-through in the switch statement ? [1]
a) the omission of fall b) the omission of break c) the omission of loop
19. Which of the following statement is used to perform the same task multiple times ? [1]
a) for b) if c) else d) switch
20.What will be output of Math.ceil(4.3) + Math.pow(4,2) [2]
a) 21 b) 21.0 c) 22.0 d) 20.0
21. How many times the following loop will execute ?
for( i=0; i<=12; i++)
a) 14 b) 13 c) 12 d) 11
22. What will be the output of following if n=3 ?
int n;
switch(n)
{ case 1: System.out.println(“grade 1”);
break;
case 2: System.out.println(“grade 2);
break;
case 3: System.ou.println(“grade 3”);
break;}
a) Grade 1 b) grade 2 c) grade 3 d) grade 4
23. What will be the output of following ?
int i,p=1;
for(i=1; i<=5; i++)
{ p = p * i; }1*1*2*3*4*5
System.out.println(p);
a) 100 b) 90 c) 110 d) 120
24. Objects that share the same attributes and behaviour are grouped together into a/an :
a. Interface
b. Alias
c. Instance
d. Class

25. _______________ is the technique of binding both data and functions together to keep them safe
from unauthorised access and misuse.
e. Abstraction
f. Encapsulation
g. Inheritance
h. Polymorphism
26. The ability of a function or object to take on multiple forms is called:
i. Abstraction
j. Encapsulation
k. Inheritance
l. Polymorphism

27. What is the name given to a memory location in Java


a. Variable
b. Constants
c. Data type
d. None of these
28. Which are the data types used in Java?
a. Primitive data type
b. Composite/reference data type
c. Both a and b
d. None of these

29. Objects communicate with each other by…


a. messages
b. blueprint
c. constants
d. keywords
30. Which operator cannot be used with if-else statement?
e. <=
f. &&
g. ||
h. ?:
31. Identify the type of error in the statement int a, double b; c;
i. Syntax Error
j. Runtime Error
k. Logical Error
l. None of the above
32. What will be the correct order of execution of these operators according to operator precedence?
A. () B. * C. > D. ++
m. A, D, C, B
n. A, D, B, C
o. A, B, D, C
p. D, A, B, C
Correct Option: b
33. Keyword that declares a variable as constant
a. finally
b. final
c. public
d. continue
34. Which statement will be used to check if the number n ends with 3 ?
a. n % 10 == 3
b. n % 10 = 3
c. n % 3 == 0
d. n % 3 = 0
35. What is the range of value that is returned by the method Math.random( )?
e. (a) greater than or equal to 0.0 and less than 1.0
f. (b) any random negative or positive real number
g. (c) greater than or equal to -1.0 less than or equal to 1.0
h. (d) less than or equal to 0.0 and greater then -1.0
36. If x = 10 find the value of y, if y = (x++) + (++x) * 2 - (--x)
i. 33 10 + 12 *2 - 11= 10+24-11=34-11=23
j. 23
k. -98
l. 25
37. If int m ; float n ; double p ; then predict the return type of expressions:
i) m * n ii) n / p
a. int , float
b. float , double
c. float , float
d. int , double
38. Select the valid Identifier name:
e. first+name
f. class
g. first_last_name
h. 2name
39. Which statement is used to take a character as an input from the user ?
i. sc.next().charAt(0);
j. sc.next().charAt(); class
k. sc.next()charAt(0); 012
l. sc.nextChar();
40. Which two data types have same size as 4 bytes?
m. int, char
n. int, float
o. int, double
p. float, double
41. Which data type is also known as Intrinsic data type?
q. Primitive data type
r. Reference data type
s. Both options a and b
t. None of the above
42. Arrange the following data types in descending order of their sizes?
1) char 2) Boolean 3) long 4) float
u. 2, 1, 4, 3
v. 3, 2, 1, 4
w. 3, 4, 1, 2
x. 4, 3, 2, 1

43. What will be the data type of variable x in the expression x=a>b?
a. long
b. boolean
c. int
d. char
44. If a = 3 and b = 7, what will be the value of p in the expression p = (a + 4 < 7 )? ‘F’: ‘T’
e. F
f. T
g. false
h. true
45. What will be the output of the expression a++%6, if initially the value of a is 4?
i. 0
j. 1
k. 4
l. 5
46. Which of the following is a unary operator?
m. %
n. >
o. /
p. ++
47. What will be the output of 45/7?
q. 6
r. 6.1
s. 6.12
t. 6.125
48. What will be the ASCII code of ‘f’ if the ASCII code of ‘F’ is 70?
u. 70
v. 75
w. 102
x. 202

49. If a user wants to execute a loop for 10 times, which of the following statements will be valid?
a) for( i = 6; i <= 26; i = i + 2)
b) for( i = 4; i <= 33; i = i + 3)
c) for( i = 0; i <= 10; i = i++)
d) for( i = 5; i <= 45; i = i + 4)

50. Keyword that declares a variable as constant


a. finally
b. final
c. public
d. continue

You might also like