Class9 Practice Session Solved
Class9 Practice Session Solved
NAME __________________________________________________
1. _____________converts the source program into the object program one line at a
time.
a. Compiler
b. Assembler
c. Interpreter
d. Developer
2. In Object Oriented Programming, using a function for many purposes is termed as
a. Polymorphism
b. Encapsulation
c. Data Abstraction
d. Inheritance
3. In class student, name, roll number are the state of the class student. What is state
with respect to Object Oriented Programming.
a. State in a class are the attributes of the class
b. State in a class are the methods of the class
c. State in a class are the values of a class
d. State in a class are the data types of the class
4. \t is the escape sequence of:
a. New line feed
b. Horizontal tab
c. Carriage return
d. Form feed
5. Which one is not a token in JAVA?
a. &&
b. \n
c. ;
d. new
6. Class is a _____
a. Non-primitive data type
b. Object Factory
c. Composite data type
d. All are correct
7. Datatype to store “M” is _________, ‘M’ is ____________
a. String, character
b. String, char
c. char, String
d. Char, string
8. int a=5 then if(a==6) returns
a. 5
b. 6
c. TRUE
d. FALSE
9. System.out.print(“Welcome\n to Kolkata”);
a. Welcome to Kolkata
b. Welcome \n to Kolkata
c. “Welcome\n to Kolkata”
d. Welcome
to Kolkata
10. The method use to input String a = “Welcome to the world of JAVA programming”;
a. next()
b. nextLine()
c. nextInt()
d. nextcharAt(0);
(a+b)*(a+b)=a*a+b*b+2*a*b
2. Find the output of int a=4, b=3, c=8, d= 9; ((c/a)<=(d/b)) ? (c-a) : (d-b)
((8/4)<=(9/3))?(8-4):(9-3)
(2<=3)?4:6
(TRUE) 4 (ans)
a = a+ a++ + ++a + -- a + a—
=14+9+8+8
=39
A syntax error is a mistake in the code's structure, while a runtime error occurs during the
program's execution.
char c =’A’;
int n = c+1;
char ch = (char)n;
n=66
ch=B