Worksheet Holidays

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Worksheet

Choose the correct answer


(a). Default value of character data type is
1. \u0000C 3. \u0000
2. \a0000 4. none of the above
(b). Which of the following is an infinite loop
1. for(a=0;i<20;a--) 3. for(a=0;a<20;a++){ }
2. while(a<20) a++; 4. for(;a<20;a+=2)
(c). Which type of casting shown by the following example
long y =15 , int x ; x = (int) y;
1. Explicit Type 2. Implicit Type Casting
Casting 3. None of the above
(d) Which keyword is used to represent the current object?
1. new 3. return
2. this 4. none of the above
(e)What is a function with the same name as that of its class is called?
1. Constructor 3. Function
2. Constructor overloading 4. Function overloading

Fill in the blanks with the correct option


(a). What is the result of 111 % 13 = _________
1. 3 3. 7
2. 5 4. 9
(b). JVM is used to convert_________ in to machine code.
1. Object Code 3.Intermediate Binary code
2. Source Code 4.None of the above
(c). A java program developed and executed by the users by using web browser is known
as ___________
1. application 3. applets
2. none 4. objects
(d) The correct constructor definition of class Cartoon that has a int and double as parameter is______
1. Cartoon (int a, double b) 3. int Cartoon (int a, double b)
2. void Cartoon (int a, double b) 4. public Cartoon (int a, int b)
(e)._____________ is not an entry controlled loop
1. break 3. do- while
2. while 4. for

Name the following


(a). Java supports this character set only.
1. ASCII 3. Unicode
2. ISCII 4. none of the above
(b). The smallest unit in a java program is known as.
1. Identifier 3. Separators
2. Token 4. JVM
(c). The extension of a java source code file
1. .java 3. .class
2. .txt 4. none of the above
(d). A keyword used to import a package in a class.
1. export 3. import
2. Token 4. impart
(e). An
1. operator
& that gives the remainder of a division operation.
3. #
2. % 4. /

State True or False


(a). The default value of boolean is.
1. true 2. false
(b). The identifier in java may be of any length.
1. true 2. false
(c). The statement p=-9 and p=p-9 is same.
1. true 2. false
(d). A method can return more than one value.
1. true 2. false
(e). The output of System.out.println(!true);is false.
1. true 2. false

Choose the odd one


(a).
1. Identifier
2. Separator
3. Keyword
4. new
(b).
1. {}
2. >
3. ;
4. ,
(c).
1. \n
2. \t
3. \r
4. ++
(d).
1. byte
2. short
3. int
4. char
(e).
1. for
2. if-else
3. while
4. do-while

You might also like