You are on page 1of 10

SECTION A (30 Marks)

Q I. Choose the correct answer: 10X1=10


1.Which language does the CPU understand?
a. Machine language
b. High level language
c. Assembly language
d. English language
2. What is the extension of a java source code file?
a. .java
b. .class
c. .txt
d. .bluej
3. Choose the correct statement.
a. Applets can be executed in web browser only
b. Applets can be executed in an applet viewer only
c. Applets can be executed in both web browser and applet viewer.
d. Applet cannot be executed
4. Suppose you compile the class CoolClass. What will be the name of the
Bytecode file?
a. CoolClass.java
b. CoolClass.class
c. CoolClass.byte
d. CoolClass.int
5. While declaring the main method, which keyword comes first?
a. Class
b. Keyword
c. Public
d. Main
6. Which of the following is not a token?
a. Keyword
b. Operator
c. Identifier
d. Procedure
7. Which of the following is not a legal identifier?
a. _room
b. 10thClass
c. $PayAmount
d. nullValue
8. which of the following is an invalid integer?
a. 5555
b. 555 55
c. 55555
d. 555
9. Which of the following is not a primitive data type in java?
a. boolean
b. float
c. short
d. class
10. what is the size of a long data type in java?
a. 32 bits
b. 48 bits
c. 64 bits
d. Long data type is not supported in java
Q II. Fill in the blanks with correct option: 10X1=10
1. A program that translates code written in a high level language into machine
code is called _______
a. Assembler
b. Compiler
c. Linker
d. None of these
2. Java can be used to write _______
a. Stand-alone applications only
b. Internet applications only
c. Both stand-alone and internet applications
d. None of these
3. A java program can run as a stand-alone application only if it has _____
a. a void method
b. a main method
c. an overloaded method
d. no methods
4. A set of instructions written in a high-level programming language is called _____
a. Object code
b. Byte code
c. Source code
d. All of these
5. ASCII is ______
a. 6-bit set of codes
b. 7-bit set of codes
c. 8-bit set of codes
d. 16-bit set of codes
6. The ASCII codes of A-Z are represented by decimal range ______
a. 65-90
b. 97-122
c. 66-91
d. 98-123
7. ______ characters are represented by ASCII character set.
a. 27=128 characters
b. 102 = 128 characters
c. 82 = 127 characters
d. 162=130 characters
8. All characters in a java program are grouped into symbol called ______
a. new
b. keyword
c. tokens
d. operators
9. Keywords are also known as ______ words
a. Literal words
b. Reserved words
c. Integer
d. Methods
10. Single line comments can be added using ______.
a. //
b. \\
c. /* */
d.Both a and b

Q III. State whether the given statements are true or false: 5X1=5
1.Java compiler is used to compile your code.
a. True
b. False
2. Ctrl+D key is used to delete the pre-written code already in it.
a. True
b. False
3. Java offers five types of tokens.
a. True
b. False
4. Default value of char data type is ‘\u0000’
a. True
b. False
5. A variable can be used in a Java program even if it has not been declared.
a. True
b. False

Q IV. Name the Size and Range for the following: 5X1=5
1. What is the size of short data type in java?
a. 16 bits (2 bytes)
b. 16 bits (1 bytes)
c. 16 bits (3 bytes)
d. 16 bits (4 bytes)
2. What is the size of int data type in java?
a. 32 bits (3 bytes)
b. 32 bits (1 bytes)
c. 32 bits (4 bytes)
d. 32 bits (0 bytes)

3. What is the size of double data type in java?


a. 64 bits (4 bytes)
b. 64 bits (8 bytes)
c. 64 bits (2 bytes)
d. 64 bits (1 bytes)
4. What is the range of byte data type in java?
a. -128 to 127
b. -32768 to 32767
c. -2147483648 to 2147483647
d. None of the mentioned
5. What is the range of char data type in java?
a. 0-65535
b. 0-45335
c. 0-23535
d. All of these

SECTION B (20 Marks)


Q V. Choose the valid option for the following: 4X1=4
1. Which one is a valid identifier in Java?
a. total amount
b. total_percentage_%
c. total amount
d. total_amount_$
2. Which one is a valid integer literal?
a. 1455
b. 67 678
c. $565
d. 876, 456
3. Which one is a valid real literal?
a. 67.E7
b. 55.5E
c. .23E7
d. $3E7
4. Which one is a valid string literal?
a. “KIPS”
b. ‘COMPUTER’
c. Z+ ‘COMPUTER’
d. ‘K’I’P’S

Q VI. Choose the odd one: 5X1=5


1. a. Machine language
b. Assembly language
c. Java language
d. High-level language
2. a. Windows
b. Byte code
c. Unix
d. Macintosh
3. a. final
b. Public
c. Class
d. Unicode
4. a. +
b. –
c. %
d. <<
5. a. byte
b. long
c. int
d. non-primitive
Q VI. Give the output for the following: 5X1=5
1. System.out.println(“Incredible” + “\n” + “world”;
a. Print
b. ln
c. incredible
d. world
2. What is the result of evaluating the following expression?
(3+6*7)/3+2
a. 24
b. 17
c. 20
d. 19
3. What is the result stored in x, after evaluating the following expression?
int x=5;
x = x++ *2+3*--x;
a. 30
b. 40
c. 25
d. 51
4. public class prefixIncrement
{
public static void main(String args[])
{
int y =15;
int z = ++y;
System.out.println(“Y: “ + Y);
System.out.println(________);
a. “y=15”
b. “z: “ + z
c. z+y
d. z=++y
5. Identify the literals listed below: 4X1=4
i. 0.5 _______

ii. false _______

iii. ‘A’ _______

iv. “a” _______

a. boolean
b. char
c. string
d. real
6. Arrange the following primitive data types in the ascending order 2X1=2
of their size.
i. char

ii. byte

iii. double

iv. int

******************

You might also like