Free Web Hosting Provider - Web Hosting - E-commerce - High Speed Internet - Free Web Page
Search the Web

HOME

chapter1 | chapter2 | chapter3 | chapter4 | chapter5 | chapter6 |

chapter7 | chapter8 | chapter9 | chapter10 | chapter11 |

chapter 1: Language Fundamentals Solutions

Question
Solution
1 c
2

c Substitute no_of_bits = ( 8 for byte , 16 for short, 16 for char, 32 for int, 64 for long, 32 for float, 64 for double).

We get (2^7) / (2^7) -1 for int and so on for other types

3 b Alphabetically by class name.
4 b
5 c. there is nothing like explicit declaration for default package. The class is added to default package if there is no package statement.
6 h Valid declaration for the main() method must be public and static, have void as return type and take a single array of String objects as arguments. The order of public and static keywords is irrelevant. Also declaring the method final does not effect the method's potential to be used as a main() method.
7 b
8 f
9 c . There are no friend functions as in C++.
10 c
11 b
12

b primitive boolean keyword is 'boolean' and boolean can be only 'true' or 'false'

13 b Array index start from 0. So somearray[0] points to the first element in the array.
14 d byte primitive range is -128 to + 127
15 b and d
16 e
17 a
18 b
19 a
20 d
21 a and b. local variables should be explicitly initialized
22 a
23 c
24 c
25 d,e
26 06, 006, 0006
27 0x0a, 0X0a, 0xa, 0Xa, 0x0A, 0X0A, 0XA
28 d. the variable y is getting read before being properly initialized
29 d. instance variable of type int and String are initialized to 0 and null respectively
30 b,d,e,f
31 d
32 c
33 c.javadoc comment is recognized only if it is placed immediately before a class, interface, method or field

banner

 

Copyrights anilbachi.8m.com

All rights reserved