0% found this document useful (0 votes)
55 views7 pages

Kanpur Road Ms Unnati Saxena CLASS X Worksheet Section A CFQ

This document is a worksheet for Class X prepared by Ms. Unnati Saxena, containing multiple choice questions and short answer questions related to Java programming concepts. It covers topics such as class variables, keywords, loops, object-oriented programming, and various Java functionalities. An answer key is provided at the end for self-assessment.

Uploaded by

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

Kanpur Road Ms Unnati Saxena CLASS X Worksheet Section A CFQ

This document is a worksheet for Class X prepared by Ms. Unnati Saxena, containing multiple choice questions and short answer questions related to Java programming concepts. It covers topics such as class variables, keywords, loops, object-oriented programming, and various Java functionalities. An answer key is provided at the end for self-assessment.

Uploaded by

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

CLASS X

WORKSHEET SECTION A
BRANCH-KANPUR ROAD
PREPARED BY MS UNNATI SAXENA

Multiple Choice Questions

1. Which of the following is the proper way to declare a class variable? [USER DEFINED METHOD]
a) class X{int a; void display(); }
b) class X{void display(static int a);}
c) class X{static int a; void display();}
d) class X{void display(){ static int a; }
2. Which of the following is a valid keyword? [INPUT IN JAVA]
a) New
b) static
c) true
d) sc
3. Which of the example of implicit type conversion? [VALUES AND DATATYPE]
a) long to double
b) char to String
c) float to long
d) Both a and b
4. Which loop is best used when you know the number of iterations beforehand?* [ITERATION]
a) for
b) while
c) do-while
d) both b and c
5. Read the program code given below carefully and answer the question number 5 i to 5 v based on
the code: [USER DEFINED METHOD]
1. class Sample
2. {
3. int x=10;
4. static int y=5;
5. Sample()
6. {
7. x=0;
8. System.out.print(y++);
9. }

10. Sample(int x)
11. {
12. y=x;
13. System.out.print(x+y);
14. }
15. public static void main()
16. {
17. Sample ob1=new Sample();
18. System.out.print(y);
19. Sample ob2=new Sample(20);
20. System.out.println(ob1.x+ob2.x+y);
21. }
22. }
5 i. Name the class variable present in the given code:
a) x
b) y
c) ob1.x
d) ob2.x
5 ii. What will the output of line number 18 after execution of main()?
a) 6
b) 5
c) Error
d) 20
5 iii. Which OOP concept is implemented in the above code?
a) Inheritance
b) Abstraction
c) Polymorphism
d) Both a and c
5 iv. What will the output of the above code after execution of main()?
a)554030
b)5540
30
c) 564030
d) Error
5 v. If a child wants to initialize instance variable through the parameter provided in Parameterized
constructor ,then what will be the correct statement?
a) ob2.x=x;
b) ob1.x=x;
c) this.x=x;
d) Can not be initialized as argument variable as same name as instance variable
6. Which of the following is FALSE with respect to static methods in a class? [ENCAPSULATION]
a) It can be called in any non static function
b) It cannot call non static function without creating object
c) It can update value of any static variable or instance variable
d) It can be pure or impure
7. Which of the following is a property of call by reference? [USER DEFINED METHOD]
a) Any change in formal parameter is not reflected in actual parameter
b) All parameters must be of primitive datatype
c) The return type should never be void
d) The address of actual and formal parameter shares the same address
8. Which of the following is NOT a function of String class? [STRING HANDLING]
a) isUpperCase()
b) toUpperCase()
c) valueOf()
d) concat()
9. Which programming construct is depicted in the picture? [PROGRAMMING CONSTRUCT]

a) Sequential Construct
b) Conditional Construct
c) Iterative Construct
d) Seasonal Construct
10. Assertion (A): The conditional flow of control can be defined with the help of if statement.
Reasoning (R): if statement executes one or more statements based on the given condition. If the
condition evaluates to true, the statement block of if gets executed, otherwise nothing gets
executed. [CONDITIONAL CONSTRUCT]
a) Both A and R are true and R is the correct explanation of A.
b) Both A and R are true but R is not the correct explanation of A.
c) A is true but R is false.
d) A is false but R is true.
11. Assertion(A): break and continue are jump statements. [ITERATION]
Reasoning(R): Jump statements can only be used with iterative construct
a) Both A and R are true and R is the correct explanation of A.
b) Both A and R are true but R is not the correct explanation of A.
c) A is true but R is false.
d) A is false but R is true.
12. A child is working on excel sheet and had created a record which hold names of 50 people along
with their pincode. He then applied some function due to which all names got arranged in
alphabetical order. Which of the following technique might be behind that function?[ARRAY]
a) Linear Search
b) Binary Search
c) Selection Sort
d) Merging
13. Frosting 10 cupcakes in identical manner is an example of : [PROGRAMMING CONSTRUCT]
a) looping
b) jump statement
c) if-else
d) switch-case
14. The extension of a file written on bluej, named Demo, after compilation will be :
[JAVA FUNDAMENTAL]
a) .java
b) .javac
c) .exe
d) .class
15. A class can be declared as : [CLASS AS BASIS OF ALL COMPUTATION]
a) public
b) protected
c) private
d) Both a and b
16. Which type of variable can be used inside the whole class block? [ENCAPSULATION]
a) static
b) non-static
c) local
d) argument
17. Which of the following is not a wrapper class? [WRAPPER CLASS]
a) Integer
b) String
c) Boolean
d) Character
18. Following a 10% decline in annual sales, an automobile company has opted to enhance the discount
offer from 5% to 10% for vehicles priced above Rs. 10 lakhs. What programming approach would be
most suitable for updating the sales calculation software? [CONDITIONAL CONSTRUCT]
a) switch case
b) if else
c) while
d) do-while
19. What is the return type of res for given code : [MATHEMATICAL LIBRARY FUNCTIONS]
res=Math.round(Math.abs(-15.3f));
a) double
b) int
c) long
d) float
20. When an array is passed as parameter to a method, what does the method receive? [ARRAY]
a) The reference of the array
b) Copy of array
c) Length of array
d) Copy of first element of array
21. Select the valid statement. [ARRAY]
a) char []ch=new char(50);
b) char []ch=new char();
c) char ch[]=new char ch[50];
d) char []ch=new char[50];
22. Which of the following is NOT a keyword? [VALUES AND DATATYPES]
a) package
b) class
c) object
d) new
23. Which of the following is an unary operator? [OPERATORS IN JAVA]
a) +
b) =
c) +=
d) &&
24. What will be the output of given code? [OPERATORS IN JAVA]
if(1 *1+ 1 + 1 + 1 + 1 == 5){
System.out.print(“TRUE”);}
else{
System.out.print(“FALSE”);}

a) TRUE
b) true
c) FALSE
d) false
25. Which component of Java is responsible for running the compiled Java bytecode?
[JAVA FUNDAMENTAL]
a) JRE
b) JIT
c) JDK
d) JVM

Answer Key: 9. b 18. b


1. c 10. a 19. c
2. b 11. c 20. a
3. a 12. c 21. d
4. a 13. a 22. c
5. i. b ii. a iii. c iv. c v. c 14. d 23. a
6. c 15. a 24. a
7. d 16. a 25. d
8. a 17. b
Short Question/Answers :
1. Differentiate between pure and impure function. [USER DEFINED METHOD]
2. What is the purpose of following keywords:
a. new
b. this
c. final
d. package
3. Identify the type of error (if any) in the given code: [ARRAY]
int []a={2,54,56,’6’};
System.out.println(a[1]+””+a[4]);
4. How many times the given while loop get executed and what will be the output?
[ITERATION AND UNARY OPERATORS]
int a=4;
while(++a<22)
{
System.out.println(a--);
a+=a;
}
5. Write the return type of the following functions w.r.t. Math and String class :
[LIBRARY CLASSES]
a. round()
b. length()
c. max()
d. random()
e. compareTo()
f. concat()
6. What is Byte Code w.r.t. Java Compilation Process ? [JAVA FUNDAMENTAL]
7. Differentiate between break and System.exit() . [JUMP STATEMENTS]
8. What will be the output of following code ? [ESCAPE SEQUENCE]
System.out.print(“Success can \”never \” be attain \”without\” “);
System.out.println(“ facing \n \“Hardship\””);
9. Identify and name the type of token: [VALUES AND DATATYPE]
a. null
b. main
c. private
d. “1”
e. ‘+’
f. !
10. Explain how Abstraction is implemented by encapsulation. [OOP CONCEPTS]
11. Differentiate between length and length() . [ARRAY AND STRING]
12. What will the output of given code? [INCREMENT &DECREMENT OPERATOR]
int x=2,y=-4;
x+=x++ + ++y –(x*y) + x++;
System.out.println(x-y);

You might also like