Q88.Given the following snippet of code 1. char c = -1;6 y) E# e9 I! G- r
What is the result of compiling the above snippet., P1 x7 G) k. ~7 S) J
a. It will cause a compiler error as the range of character is between 0 and 2^16 - 1. Will request for an explicit cast.
- A k4 v: D1 p! S b. It will not cause a compiler error and c will have the value -1;
2 o0 u4 v! E8 ~6 E c. The variable c will not represent any ascii character.
, s7 F/ L0 r1 N, Z# ?4 j$ y5 D d. The variable c will s till be a unicode character., k2 }: W; X4 Y5 B( q* P7 M
Q89.Given the following code fragment.
& v8 d) B4 E* u) I3 l0 M/ R 1. switch( x ) {6 `. `- U$ Q l2 Q/ e' a
2. case 1005 P! X- G4 r( K2 F0 }1 U
3. System.out.println(“One hundred”); break;
! ~' f& M5 K! ^9 R. u 4. case 200
- f* L; w3 L0 @, D1 } 5. System.out.println(“Two hundred”); break;
1 \2 T( C1 R( ]# x4 R 6. case 300# ~0 g3 G2 Y4 i I
7. System.out.println(“Three hundred”); break;& `8 V5 [' U3 i. R8 ~) Z
8. }% q1 P4 w- G4 V& W7 U1 P7 _. F
Choose all of the declarations of x that will not cause a compiler error.: v9 C% ^" U6 b0 C! ]1 W
a. byte x = 100;
1 O( U' I, R9 m0 T' Q b. short x = 200;& \( V: ]$ x2 m& N# Z( ^. S4 P; I' K
c. int x = 300;1 `0 ~% G$ {3 ]" A& i
d. long x = 400;- Q4 m8 w- {* D
Q90.What happens to the file system when the following code is run and the myFile object is created? Assume that name represents a valid path and file name for a file that does not presently exist.: l& R# M8 K y/ Y' P
1. File createFile(String name) {. t& d9 H) y6 {# c& S' { a8 J
2. File myFile = new File(name);
" b _! }8 u# q3 k% F, k 3. return myFile;5 m% m0 w9 `% L1 W4 H, x
4. }& \$ N$ O# F/ i) |
[Check all correct answers]
3 v0 m7 Q5 k0 _. u- C/ z a. A new empty file with that name is created but not opened.
* R5 c+ q2 w, M3 M$ D$ a b. The current directory changes to that specified in name
/ }4 m1 ? r" ]1 Q c. A new emty file with that name is created and opened.
8 ~' P2 Q4 Y" q d. None of the above0 N8 n/ K$ Q: ?8 u
88. a
4 C! s# W- Y" f$ t 89. bc
* v$ J* l Q+ K ~3 q. { 90. d |