1. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 1
Que 1 : What is a Classes?
A: classes are group of data member and member function.
Syntax :
Class classname // instance class (local – class)
{
Field Declaration ; // instance variable declaration
Methods Declaration; // instance methods declaration
}
Class classname
{
Public static void main(String s[ ])
{
Body of the code;
}
}
2. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 2
Que 2: What is a Instance Variable?
A: Instance variables are variables within a class but outside any method.
These variables are instantiated when the class is loaded.
Syntax :
Class classname
{
Field Declaration ; // instance variable declaration
Methods Declaration; // instance methods declaration
}
Que 3: What is Class Variable?
A: These variables are declared with in a class, outside any method, with the
static keyword.
Que 4: What is Local Variable?
A: Variables defined inside methods, constructors or blocks are called local
variables. The variable will be declared and initialized within the method and
it will be destroyed when the method has completed.
Que 5: What is Object?
A: An object is runtime entity of the real world.
An object in java are create using the ‘ new ‘ operator.
Syntax :
Classname objectname = new classname( );
3. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 3
4. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 4
5. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 5
6. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 6
7. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 7
8. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 8
9. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 9
10. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 10
11. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 11
12. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 12
}
}
13. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 13
14. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 14
15. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 15
16. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 16
17. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 17
18. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 18
19. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 19
20. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 20
21. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 21
22. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 22
23. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 23
24. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 24
25. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 25
26. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 26
27. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 27
28. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 28
29. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 29
30. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 30
31. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 31
32. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 32
33. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 33
34. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 34
35. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 35
36. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 36
37. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 37
38. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 38
39. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 39
40. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 40
41. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 41
Fill in the blanks in each of the following statements:
a) Lists and tables of values can be stored in .
ANS: arrays.
b) The elements of an array are related by the fact that they normally
have the same
.
ANS: type. [Note: In the book, the answer is incorrectly stated to be
“name.”]
c) The number used to refer to a particular element of an array is called
its .
ANS: subscript.
d) The process of putting the elements of an array in order is called the
array.
ANS: sorting.
e) Determining whether an array contains a certain key value is called the
array.
ANS: searching.
f) An array that uses two subscripts is referred to as a(n) array.
ANS: two-dimensional.
10.2 State whether each of the following is true or false. If false, explain
why.
a) An array can store many different types of values.
ANS: True.
b) An array subscript should normally be a floating-point value.
ANS: False. An array subscript must be an integer or an integer
expression.
c) An individual array element that is passed to a function and modified in
it will contain the modified value when the called function completes
execution.
ANS: False. Individual primitive-data-type elements are passed by value.
If a reference to
an array is passed, then modifications to the elements of the array are
reflected in the
42. SMT. K K PATEL MBA / MCA COLLEGE
PINKESH MODI (MCA) PAGE NO : 42
original element of the array. Also, an individual element of an object type
passed to
a function is passed by reference, and changes to the object will be
reflected in the
original array element.