ANSWER KEY (7) - 70 Que
ANSWER KEY (7) - 70 Que
ANSWER KEY (7) - 70 Que
Textbook Exercise
(1) How many basic (primitive) data types are supported in Java?
(A) 2 (B) 4 (C) 8 (D) 16
(2) What is the default data type of floating point literal?
(A) int (B) long (C) float (D) double
(3) Which character set is used for char data type in Java?
(A) Unicode (B) ASCII (C) EBCIDIC (D) All of these
(4) Which of the following is compiled error free?
(A) for (;;) {int i=7} (B) while (1) {int i=7}
(C) while (True) {int i = 7} (D) All of these
(5) Which of the following is not allowed as first character in valid variable name?
(A) Underscore (_) (B) Digit (C) Letter (D) Dollar ($)
(6) Which of the following is not a basic data type in Java?
(A) char (B) long (C) byte (D) String
(7) What is the default value of boolean type data?
(A) null (B) true (C) false (D) 0
(8) What will be the result of arithmetic expression 7/2?
(A) 3 (B) 3.5 (C) 1 (D) 0
(9) What will be the result of arithmetic expression –7%2 ?
(A) –3 (B) –1 (C) 1 (D) –3.5
(10) What will be the result of arithmetic expression –7.5%2 ?
(A) –3 (B) –1.5 (C) 1.5 (D) Error
(11) What sign is used for creating API documentation form the code?
(A) // (B) /* ..... */ (C) /** ..... */ (D) \\
(12) In Java, which of the following looping is exist controlled?
(A) for (B) while
(C) do.....while (D) if.....then.....else
(13) In Java, which of the following is not allowed as first character in valid variable name?
(A) _ (Underscore) (B) Digit (C) Letter (D) $ (Dollar)
(14) What is known as when program written in Java are compiled in to machine language for
a computer?
(A) Java Visible Machine (B) Java Virtual Machine
(C) Java View Modifier (D) Java Visible Modifier
(15) What is known as post decrement in Java when operator is used after variable name?
(A) ++ (B) – – (C) == (D) =<
(16) By using which extension file java interpreter byte code executes?
(A) .java (B) .class (C) .txt (D) .html
(17) In Java, which statement is used when there are many alternative actions to be taken
depending upon the value of a variable or expression ?
(A) Switch (B) Nested if (C) Control (D) Repeat
Page 1
(18) What kind of the primitive data types are provided in Java from the following?
(A) boolean (B) double (C) char (D) All of these
(19) What is the value of float data type in Java?
(A) Integer (B) Real (C) Character (D) Boolean
(20) In Java what will be the result of arithmetic expression –7.5%2?
(A) –3 (B) –1.5 (C) 1.5 (D) Error
(21) Java language is developed by which company?
(A) Sun Microsystem (B) Sun Java System
(C) Sun system (D) Sun Microsoft
(22) The machine language for the Java Virtual Machine is called what?
(A) Code Byte (B) Type code (C) Java Bytecode (D) Java code
(23) While creating Java what must be the same?
(A) folder name, file name (B) class name, extension
(C) class name, folder name (D) class name, file name
(24) When the program gets compiled without error, compiler creates a file with which
extension ?
(A) .comp (B) .txt (C) .java (D) .class
(25) The process of compiling and executing a Java application is as follows. What is missing
from given chart ?
Java source file (.java) Java compiler (javac) ? JVM – Java Interpreter (java)
(A) Java class (*.exe) (B) Java textcode (*.txt)
(C) Java Bytecode (*.class) (D) Java typecode (*.obj)
(26) Which of the following is right way to define variable?
(A) $age (B) discount rate (C) 4youpeople (D) %discount
(27) String literals is a sequence of characters enclosed in which quotes?
(A) ‘ ’ (B) “ ” (C) ( ) (D) { }
(28) Which of the two symbols are used in the conditional operator in Java?
(A) : and * (B) # and ? (C) ? and : (D) / and ?
(29) While using shorthand version of assignment, if it is defined as a+ =b, where a is 7 and b is
8, then what will result of a?
(A) 8 (B) 49 (C) 14 (D) 15
(30) When two operators are having different priority, then an operator with higher
precedence is operated .....
(A) first (B) last (C) second (D) middle
(31) What will be output of following program?
class abc
{
public static void main (string [] S)
{
for (int i=0; i<10; i++)
{
SYSTEM.out.println(i);
}
}
}
(A) Error (B) i (C) Display 1 to 10 (D) 1, 2, 3, ..... 10
Page 2
(32) Control structure branches are used to choose among two or more possible courses of
action, is called as what?
(A) More structure (B) Loop structure
(C) Addition structure (D) Selective structure
(33) Switch statement can be stopped using which statement?
(A) break (B) run (C) loop (D) error
(34) do..... while loop is which type of loop?
(A) Loop controlled (B) Break controlled(C) Exit controlled (D) Entry controlled
(35) To use a labeled loop, which symbol is added before the loop?
(A) * (B) $ (C) : (D) #
(36) In Java, the text written in /* ..... */ is considered as what?
(A) Method (B)Comment (C) Function (D) Variable
(37) User can create Java source file by using .....application.
(A) SciTE editor (B) ASCII text editor (C) Both (A) and (B) (D) None of these
(38) The definition of the method (function) in Java consists of function header and the
sequence of statement enclosed in which bracket?
(A) { } (B) < > (C) ( ) (D) [ ]
(39) Java supports how many primitive data types?
(A) 3 (B) 8 (C) 4 (D) 7
(40) Which of the following data type is used for real numbers?
(A) short (B) char (C) long (D) double
(41) From the following which is considered as one of the ideal language for distributing
executable program and also general purpose programming language for developing
programs that are easily usable and portable across different platforms ?
(A) C language (B) Java (C) Visual Basic (D) JavaScript
(42) Which extension is used to source file of Java language, written in a text editor?
(A) .class (B) .html (C) .jpg (D) .java
(43) From the following which methods are used to display results?
(A) System.out.print() (B) System.out.println()
(C) Both (A) and (B) (D) System.print.display()
(44) In Java, the program is compiled without any error, which command is used to execute it?
(A) Tools Go (B) Tools Run (C) Tools Build (D) Tools Compile
(45) How many primitive data types are there in Java?
(A) 5 (B) 6 (C) 7 (D) 8
(46) From the following which are the examples of reserved words in Java?
(A) class (B) public (C) static (D) All of these
(47) A name used for a constant value is known as what in Java?
(A) String (B) Array (C) Literal (D) Class
(48) Which sign is used to insert single line comment in Java?
(A) /* and */ (B) /** and */ (C) // (D) #
Page 3
(51) In Java, at which level platform – independence is possible due to bytecode interpreter?
(A) Browser (B) Source (C) Machine (D) Binary
(52) In Java, the machine language for Java Virtual Machine is known as which code?
(A) Java filecode (B) Java bytecode (C) Java intcode (D) Java sourcecode
(53) To compile the java program we have to type what in front of source file name?
(A) javac filename.java (B) javac filename\ (C) javac filename.html (D) javac filename.java
(54) If Java program is compiled without any error we can execute it in SciTE editor by which
menu - option ?
(A) Compile Run Go (B) Edit Go (C) Tools Go (D) File Go
(55) Java supports how many primitive data types?
(A) 2 (B) 4 (C) 6 (D) 8
(56) What is the storage space for datatype float in Java?
(A) 1 byte (B) 2 byte (C) 4 byte (D) 8 byte
(57) Real numbers in Java are compliant with which of the following?
(A) IEE 36 (B) IEE 16 (C) IEEE 780 (D) IEEE 754
(58) In Java, variable name should begin with which of the following?
(A) Alphabet (B) Underscore (_) (C) Dollar sign ($) (D) All of these
(59) In Java, a name used for constant value is known as what?
(A) String return (B) Literal (C) Unicode Quote (D) ASCII
(60) Java 7 also supports binary numbers, using digits 0 and 1 but it should be prefix by which
of the following ?
(A) 0b or 0B (B) B (C) B1 (D) B0
(61) In Java, for type boolean there are precisely two literals, which are they?
(A) Y and N (B) 0 and 1 (C) True and False (D) Yes and No
(62) In Java, characters are stored by how many bit Unicode characters?
(A) 4 - bit (B) 8 – bit (C) 16 – bit (D) 32 - bit
(63) String literals in Java is a sequence of characters which can be enclosed in which of the
following ?
(A) $ ..... $ (B) “ ” (C) ` ` (D) ‘ ’
(64) In Java, documentation comments begins and ends with which of the following?
(A) /** ..... */ (B) /* ..... */ (C) /* ..... / (D) //
(65) Arithmetic operators in Java, can be applied on which numeric data?
(A) short (B) float (C) byte (D) All of these
(66) In Java,which of the following is known as unary operators for increment and decrement
operators?
(A) >== and <= (B) + and – (C) == and != (D) + + and - -
(67) Which of the following is considered as comparison operator in Java?
(A) = (B) / (C) % (D) !=
(68) In Java, logical operators are also called which of the following operators if they operate
on Boolean operands ?
(A) Assignment operator (B) Boolean operator (C) Increment operator (D) Relational operator
(69) In Java, conditional uses which two symbols in expression to delimit three operands?
(A) ? and * (B) . and : (C) ? and : (D) : and ;
(70) In Java, a block statement is a group of statements enclosed between which pair of braces?
(A) [/ ..... /] (B) { } (C) ( ) (D) [ ]
Page 4