EM STD 12 CH 7 - Solution-1
EM STD 12 CH 7 - Solution-1
Page 1
(A) jdk (B) javac (C) ecj (D) None of these
Ans. : javac
11. How to Compile Java source file in SciTE editor ?
(A) (B) Tools 2 Compile (C) Edit 2 Compile (D) File 2 Compile
Option 2 Compile
Ans. : Tools 2 Compile
12. ………… is not valid for the name of the class.
(A) Call Cost (B) interest (C) Call Range (D) Area
Ans. : Call Range
13. What is the default value in byte data type ?
(A) 1 (B) 0 (C) 128 (D) 255
Ans. : 0
14. In which data type default value is false ?
(A) float (B) short (C) Boolean (D) char
Ans. : Boolean
15. Changing of data during the cause of the program is called ……….. .
(A) data change (B) Type-cast (C) change data (D) None of these
Ans. : Type-cast
16. If numeric literal is preceded with ……….. then it becomes octal value.
(A) L (B) l (C) OX (D) O
Ans. : O
17. How many clear literals are there for Boolean ?
(A) 2 (B) 3 (C) only one (D) 4
Ans. : 2
18. In C language, non zero value is known as ………. .
(A) true (B) false (C) zero (D) constant value
Ans. : true
19. How are the basic arithmetic operators in Java ?
(A) Binary (B) Octal (C) Hexadecimal (D) Decimal
Ans. : Binary
20. 8 % 3 will give ………… output.
(A) 1 (B) 2 (C) 3 (D) 4
Ans. : 2
21. Comparison Operator give ………… result.
Page 2
(A) Numbered (B) Boolean (C) 0 (D) > 0
Ans. : Boolean
22. What is the default data type of floating point literal?
(A) float (B) double (C) int (D) long
Ans. : double
23. Which character set is used for char data type in Java?
(A) Unicode (B) EBCDIC (C) ASCII (D) All of these
Ans. : Unicode
24. Which of the following is compiled error free?
(A) for (; ;) {int i = 7}; (B) while (l) {int i=7>;
(C) while (True) {int i = 7}; (D) All of these
Ans. : C++
28. What was the level at which was Java language designed to be portable across
platform operating system?
(A) Source Program (B) Binary (C) a and b both (D) None of these
Page 3
31. Which of the following languages is considered as one of the ideal languages
for distributing executable programs via the World Wide Web?
(A) ASP.NET (B) Java (C) PHP (D) VB.NET
Ans. : Java
32. Which of the following languages is considered as a general — purpose
programming language?
(A) Java (B) PHP (C) ASP.NET (D) VB.NET
Ans. : Java
33. Which type of language is Java considered?
(A) For distributing executable programs via the www
(B) Easily usable across different platforms
(C) General-purpose for developing programs that is portable
(D) All of these
Ans. : Java
38. At which of the following both levels doe Java platform remain independent?
(A) Source program and Binary
(B) Source program and Octal
(C) Source program and Hexadecimal
Page 4
(D) Source program and Assembly
Ans. : Virtual
41. What is referred to as a Java virtual computer?
(A) JVM (B) JIK (C) JRE (D) JAV
Ans. : JVM
42. Which is the form of Java binary files actually?
(A) Byte Code (B) Code (C) Virtual Code (D) Vcode
Ans. : Different
44. What is the disadvantage of using a bytecode?
(A) Its slow execution speed. (B) Its medium execution speed.
(C) Its fast execution speed. (D) It cannot be execute
Ans. : Its slow execution speed.
45. Which of the following is used to convert java bytecodes into native code?
(A) Tools (B) Kernel (C) Code Engine (D) None of these
Ans. : Tools
46. How is native code to execute?
(A) Fast (B) Slow (C) Slower (D) Medium
Ans. : Fast
47. ‘Which code is faster to execute but it does not remain machine independent?
(A) Byte code (B) Native code
(C) Script code (D) None of these
Ans. : Native code
48. How many minimum classes should a Java program have?
(A) One (B) Two (C) Three (D) Four
Page 5
Ans. : One
49. Which method is a must in a Java program?
(A) write0 (B) open0 (C) show0 (D) main0
Ans. : main0
50. Which of the following language’s programmers can think of a class as a sort of
creating a new composite data type by using ‘strict’ and ‘typedef’?
(A) C (B) Java (C) Basic (D) Cobol
Ans. : Bytecode
55. In which of the following, the Java Interpreter is called simply using java?
(A) JDK (B) JKD (C) JRE (D) JAK
Ans. : JDK
56. Which code is not needed to execute Java program?
(A) Source (B) Class (C) JDK code (D) None of these
Ans. : Source
57. What name should be of source file when class is public?
(A) As the Class (B) Starts with java (C) Ends with java (D) Any
name
Page 6
Ans. : Bytecode file
59. In which routine is the body of the program contained?
(A) class0 (B) main0 (C) java0 (D) first0
Ans. : main0
60. Which of the following methods takes a value to be displayed as an argument?
(A) System.out.print (B) System.out.println
(C) a nd b both (D) None of these
Ans. : a nd b both
61. Which of the following methods adds a linefeed after the end of the information
that is displayed?
(A) System.out.prinln (B) System.out.print
(C) System.println (D) System. Print
Ans. : System.out.prinln
62. In which symbol is the string literal enclosed in System.out.print0 method?
(A) Single Quote (‘‘) (B) Double Quote (““)
(C) Back Quote (‘‘) (D) None of these
Ans. : Tools→Go
66. By using what do the syntax rules specify how programs can be constructed?
Page 7
(A) Variable, expressions (B) Statements, branches
(C) Method, loop (D) All of these
Ans. : All of these
67. What is used to describe something actual we need to type while writing actual
program?
(A) Place holder (<>) (B) []
(C) a and b both (D) None of these
Ans. : Place holder (<>)
68. Which type of language is Java so that everything is defined as part of class?
(A) Object-oriented (B) Multimedia-oriented
(C) Symbol-oriented (D) Array-oriented
Ans. : Object-oriented
69. Whose part can a method be?
(A) Class (B) Data (C) Type (D) Rules
Ans. : Class
70. What is in the first line in structure of a Java Program?
(A) Class name (B) Variable (C) Data type (D) Function
Ans. : Reader
75. Which of the following is an integer number?
(A) -38477 (B) 0 (C) 4.5 (D) a and b both
Ans. : a and b both
Page 8
76. Which of the following data type holds one of the two logical values (true or
false)?
(A) Boolean (B) Char (C) Byte (D) Long
Ans. : Boolean
77. The data types that are built into the system are known as following type of
data type.
(A) Secondary (B) Primitive (C) Main (D) Master
Ans. : Main
78. In which range do the integer numbers with b bits precision store signed
values?
(A) 2111 to 2b-1 (B) 2b to 2b-1 (C) Oto2b_i (D) None of these
Ans. : 2111 to 2b-1
79. By which name is an international standard for defining floating-point numbers
and arithmetic known?
(A) IEEE (B) Unicode (C) ASCII (D) EBCDIC
Ans. : IEEE
80. Because of what can Java use thousands of characters from many different
languages and different alphabets?
(A) It has 16 bits of precision and is unsigned.
(B) It has 8 bits of precision.
(C) It has 4 bits of precision.
(D) None of these
Ans. : It has 16 bits of precision and is unsigned.
81. Which type of data value a variable can take at different times during the
execution of the program?
(A) Only one (B) Different (C) Defined (D) None of these
Ans. : Different
82. Which type of memory location is referred by a variable that can take different
data values at different times during the execution of the program?
(A) Same (B) Variable doesn’t (C) Different (D) Can’t say
have location
Ans. : Same
83. Which kind of variable can only be used in Java?
(A) Declared (B) Undeclared (C) Textual (D) Numerical
Ans. : Declared
Page 9
84. What is the syntax of declaring variable in Java?
(A) \{variable-names (B) \& Type nome > ) variable names;
(C) \{Variable names\}: (D) None of these
Ans. : Reserved
88. Which of the following are Camel case words?
(A) Balance Amount (B) Birth Date (C) Product (D) a and b both
Ans. : a and b both
89. What can we say for variable names like Balance, balance and BALANCE?
(A) They are Different. (B) First two are same.
(C) They are same. (D) Last two are same.
Ans. : Variables which are not important to overall logic of the function
92. In which is the item declared optional in the syntax of variable declaration?
(A) <> (B) {} (C) [ ] (D) All of these
Ans. : [ ]
Page 10
93. Which is the name used for a constant value?
(A) String (B) Literal (C) Boolean (D) Float
Ans. : String
94. Which of the following is a numeric literal?
(A) 17.5 (B) 157 (C) Both a and b (D) \n
Ans. : 37
99. In hexadecimal, which digits represent, letters A to F respectively?
(A) l0 t ol5 (B) 8 to 14 (C) 11 to 16 (D) 9 to 15
Ans. : l0 t ol5
100. What is used as prefix for hexadecimal literals in Java?
(A) Ox or OX (B) 0 (C) X or X (D) L or 1
Ans. : Ox or OX
101. Which of the following literal consists of \u followed by four hexadecimal digits?
(A) Character (B) Unicode (C) Numeric (D) None of these
Ans. : Unicode
102. What do e12 and 12.373e-108 represent in 1.3e12 and 12.373e-108?
(A) Square of 10 (B) Powers of 10 (C) |Cube of 10 (D) Powers of 2
Ans. : Powers of 10
103. Which of the following literal has default type as double?
(A) Integer (B) Floating-point (C) Unicode (D) Boolean
Page 11
Ans. : Floating-point
104. What should be appended as a suffix to make a literal of type ‘float’?
(A) F or f (B) T or t (C) 0 or 0 (D) L or 1
Ans. : F or f
105. What is written to specify literal 1.2 to be considered as a value of type ‘float’?
(A) 1.2L (B) F—1.2 (C) 1.2F (D) L—1.2
Ans. : 1.2F
106. Which two of the following literals are for Boolean type?
(A) True and false (B) 0 and 1 (C) T and F (D) Y and N
Ans. : 0 and 1
107. In C language, as what are zero and non-zero values treated respectively?
(A) True and false (B) False and true
(C) Positive and negative (D) Negative and positive
Ans. : Float
122. What is it called when ++ operator is used after variable name?
(A) Post-increment (B) Pre-increment
(C) Pre-decrement (D) Post-decrement
Ans. : Post-increment
123. What is it called when _ _ operator is used after variable name?
(A) Post-decrement (B) Post-increment (C) Pre-decrement (D) Pre-increment
Ans. : Post-decrement
124. What will be the values of x and y after executing y = 4 + x++; if value of x is 3?
(A) 4, 7 (B) 3, 7 (C) 3, 4 (D) 4, 8
Ans. : 4, 7
125. What will be the values of x and y after executing y = 4 + ++x; if value of x is 3?
(A) 4, 8 (B) 4, 7 (C) 3, 7 (D) 3, 4
Ans. : 4, 8
126. What will be the values of x and y after executing y = 4 + x — —; if value of x is
3?
(A) 2, 7 (B) 6, 2 (C) 4, 7 (D) 4, 8
Ans. : 2, 7
127. In how many terms of statement the increment and decrement operator is
used, but the use of pre or post does not make any difference?
(A) Single term (B) More than one (C) Three terms (D) Two terms
Ans. : Single term
128. Which operator is also known as comparison operator?
(A) Relational (B) Logical (C) Arithmetic (D) Unary
Ans. : Relational
129. Which Java statement is used to display variable A and variable B as not equal?
(A) A==B (B) A<>B (C) A B (D) A!= B
Ans. : A!= B
130. Where are relational operators used usually?
(A) In the if statements (B) In the Loop
(C) Both a and b (D) None of these
Ans. : Both a and b
131. Which of the following operators are used to compare Boolean values?
(A) = = (B) ! (C) Both a and b (D) None of these
Ans. : Both a and b
132. Which of the following are logical operators in Java?
(A) And (B) Or, Xor (C) Not (D) All of these
Ans. : All of these
133. Which error would have been there for the value of x is zero in (x!=0) && (y/x>1)
expression?
(A) Division by zero (B) Zero Division (C) Not Possible (D) Error
Ans. : Division by zero
134. How many operands are there in the conditional operator?
(A) Three (B) Two (C) Four (D) One
Ans. : Three
135. Which symbols are used in expression to delimit three operands in the
conditional operator?
(A) ? and: (B) :and; (C) . and: (D) ? an
Ans. : ? and:
136. Which value will be the value of entire expression if the value of first operand is
true in the conditional operator?
(A) Third operand (B) Second operand (C) Fourth operand (D) Anyone
(expression 2) (expression 1) (expression 3)
Ans. : Second operand (expression 1)
137. What will be the value of “next” variable in the expression next = (N % 2 == 0)?
(N/2) (3*N+1) when value of N is odd number?
(A) (3*N+1) (B) NJ2) (C) Error (D) Any one
Ans. : (3*N+1)
138. What does represent in an assignment syntax?
(A) Data value (B) Calculation (C) Both a and b (D) None of these
Ans. : Both a and b
139. Which is the expression in the statement rate = 10.02f?
(A) 10.02f (B) F (C) Rate (D) =
Ans. : 10.02f
140. What does it refer when a variable is used in an expression on the right-hand
side?
(A) To the value (B) To increase the (C) To assign value (D) To decrease the
stored in the value of the variable to the variable value of the variable
variable
Ans. : Higher
150. Which will be the first process in a + b * C 7
(A) a + b (B) b * c (C) a * c (D) a + c
Ans. : b * c
151. How is the precedence of multiplication than addition in action of addition and
multiplication?
(A) More (B) Negligible (C) Less (D) Same
Ans. : More
152. Which of following is used to avoid confusion during calculation?
(A) ( ) (B) { } (C) < > (D) [ ]
Ans. : ( )
153. What does associativity determine?
(A) The direction in which operations (B) The order in which operations are
are performed (Left to Right or Right performed
to Left) (C) Both a and b
(D) None of these
Ans. : The direction in which operations are performed (Left to Right or Right to
Left)
154. From x=y=z=7, what to understand of the following, it will give 7 to value of
three variables?
(A) x = (y = (z = 7)) (B) (x=y) = (z=7) (C) (x=y=z)=7 (D) (x=y=) z=7
Ans. : x = (y = (z = 7))
155. What will be first evaluated in x = y = z = 7?
(A) z=7 (B) x=y (C) y=z (D) x=7
Ans. : z=7
156. How is the expression 72/2/3 treated?
(A) (72/2)/3 (B) 72 / (2/3) (C) (72/3) /2 (D) 72 / (3/2)
Ans. : (72/2)/3
157. Which of the following operator has left-to-right associativity?
(A) ++ (B) = (C) += (D) /
Ans. : /
158. In general, how are the statements executed?
(A) Randomly (B) Ordered
(C) Disordered (D) In descending order
Ans. : Ordered
159. What are those statements known as that enable to control the flow of
execution?
(A) Loop structures (B) Nested (C) Control (D) None of these
structures structures
Ans. : Control structures
160. Which of the following is used to choose among two or more possible courses
of action?
(A) Branches (B) Loops (C) Function (D) Block
Ans. : Branches
161. What is used to group related statements logically?
(A) Block (B) Type-casting (C) Nesting (D) None of these
Ans. : Block
162. What kind of variable is to be when we declare a variable inside a block?
(A) Local to block (B) Local to (C) Global (D) None of these
program
Ans. : Local to block
163. What kind of variable is to be when we declare a variable inside a block?
(A) Inaccessible to outside that block (B) Invisible
(C) Both a and b (D) None of these
Ans. : Both a and b
164. What can a variable to the block be called?
(A) Non-local (B) Local (C) Global (D) None of these
Ans. : Global
165. What happens when we declare a variable with the same name as of the
variable in scope?
(A) There will be an error.
(B) Another variable will be created with the same name.
(C) Another variable will be created with the different name.
(D) None of these
Ans. : There will be an error.
166. What happens when we declare a variable inside other block of program as
same name as declared inside in main () method?
(A) There will be conflict with both variables and error will be displayed.
(B) Textbox for changing name will be displayed.
(C) Variable will be created.
(D) None of these
Ans. : There will be conflict with both variables and error will be displayed.
167. Which of the following statement enables to take one of two alternative courses
of action, depending on whether the value of a given Boolean valued expression
is true or false?
(A) For (B) While (C) Else (D) if
Ans. : if
168. As which of the following control structure is the ‘if’ statement known?
(A) Branching (B) Decision (C) Selective (D) All of these
Ans. : All of these
169. How many statements are there as statement in ‘if’ statement?
(A) One (B) Block (More (C) a or b (D) None of these
than one)
Ans. : a or b
170. What is advisable to use in ‘if’ statement?
(A) Block (B) Typecasting (C) Nesting (D) None of these
Ans. : Block
171. Write Java statement to check whether the value of variable ‘marks’ is greater
than or equal to 70.
(A) If (marks > 70) (B) If [marks > 70] (C) If (m > 70) (D) If (m>=70)
Ans. : If (marks > 70)
172. 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) For (C) If (D) While
Ans. : Switch
173. In which of the following statement, the result of the test expression must be of
the type taking discrete values?
(A) Switch (B) For (C) If (D) While
Ans. : Switch
174. Which of the following should be a type of the test expression in ‘switch’
statement?
(A) Byte, char (B) Short, int (C) Enema (D) All of these
Ans. : All of these
175. Which statement does not exist and if there is no match in any of the cases, the
‘switch’ statement completes without doing anything?
(A) Default (B) None (C) Last (D) End
Ans. : Default
176. Which statement is used to break the ‘switch’ statement?
(A) Default (B) Break (C) End (D) Last
Ans. : Break
177. Which types of looping constructs does Java support?
(A) For (B) While (C) Do…while (D) All of these
Ans. : All of these
178. In which loop, it is possible that statements in a loop are not executed at all?
(A) For and while (B) Do…while (C) If and switch (D) All of these
Ans. : For and while
179. Which loop is used usually when number of iterations is predetermined?
(A) While (B) Do…while (C) For (D) All of these
Ans. : For
180. Which is the first expression in ‘for’ loop?
(A) Initialize (B) Condition (C) Iterate (D) Last value
Ans. : Initialize
181. ‘which is the second expression in ‘for’ loop?
(A) Condition (B) Initializer (C) Iterator (D) Last value
Ans. : Condition
182. Which type of loop is the ‘do…while’ loop?
(A) Exit-controlled (B) Post-test (C) Entry-controlled (D) Both a and c
Ans. : Both a and c
183. In which loop, the test expression is evaluated after executing the statements in
a loop?
(A) While (B) Do…while (C) For (D) All of these
Ans. : Do…while
184. Which statement is used in ‘switch’ structure so that it skips all the following
statements and control is transferred at the first statement after the end of
‘switch’ statement?
(A) Continue (B) Default (C) Break (D) Go
Ans. : Break
185. To exit from what, is the break statement in loop to be used?
(A) Program (B) Editor (C) Loop (D) All of these
Ans. : Editor
186. Which class defines a whole set of math operations in Java?
(A) JMath (B) MathJ (C) Math (D) MathC
Ans. : Math
187. Function sqrt0 is one of the static method members of the following class.
(A) MathJ (B) Math (C) JMath (D) MathC
Ans. : Math
188. What is used if we want to control a loop to break and a loop to reiterate?
(A) Labelled loop (B) Hided loop (C) Highlighted loop (D) Advanced loop
Ans. : Labelled loop
189. Which of the following is a use of labelled loop?
(A) To control the exit of certain loop (B) To control the reiteration of certain
loop
(C) a and b both (D) None of these
Ans. : a and b both
190. How many byte Unicode character is character in Java?
(A) 2 (B) 3 (C) 4 (D) 5
Ans. : 2
----- EM STD 12 CH 7 -----