Std 12 Computer Chapter 9 Working with Array and String in Java important MCQs
Std 12 Computer MCQs
Computer std 12 mcq ch 9
computer std 12 ch 9 mcq
std 12 important mcq
chapter 9 working with array and string
1 d array (single dimensional array)
2 d array
String in java
2. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
1. What do we call the basic data type which can store only one value at a time?
a) Local variable
b) Scalar variable
c) Static variable
d) Instance variable
2. What do we call the data type that can be used to store a collection of more than
one data values?
a) Scalar variable
b) Constructor
c) Basic variable
d) Composite variable
3. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
3. Which kind of variable is a variable representing a collection of homogeneous type
of elements?
a) Array
b) Global
c) Instance
d) Local
4. What is useful when same operations are to be performed on various elements of
the similar type in Java ?
a) String
b) Array
c) If ... Then
d) While
4. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
5. Arrays are useful to represent which type of data in Java ?
a) Vector
b) Matrix
c) Multi dimensional
d) All of these
6. Which of the following are useful to represent vector, matrix and other multi -
dimensional data ?
a) Variable
b) Element
c) Tag
d) Array
5. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
7. Java does not support ............. type of an array.
a) 1 D
b) 2 D
c) Multi – dimensional
d) Both b and c
8. ................. is a 1D data structure that can be used to store list of items like
character, numbers in Java.
a) Matrix
b) Vector
c) Composite
d) Static
6. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
9. .............. is used to represent 2 – D data structure like table of rows and columns.
a) Matrix
b) Vector
c) Composite
d) Static
10. Which type of array is used like table of rows and columns ?
a) Primitive array
b) Minor array
c) 1- D array
d) 2- D array
7. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
11. How do we identify each element of array?
a) By a pointer
b) By an index position
c) By memory allocation
d) All of these
12. An index position of an array is associated with array ..................
a) Method
b) Function
c) Variable
d) Class
8. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
13. What specifies the position of an element in an array ?
a) Serial
b) Index
c) Number
d) Class
14. Which of the following refer to the starting index value in arrays?
a) 1
b) 0
c) Null
d) All of these
9. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
15. What is the process of making an object used to manage list of items in array?
a) Declare an array object
b) Create an array object
c) Both (a) and (b)
d) Define object method
16. An array object can be created in how many ways ?
a) Directly initializing the content of array
b) Specify the size
c) Using new operator and specifying the size
d) Both a and c
11. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
17. Which of the following syntax is used to declare array in java ?
a) <data type>[ ] < array name>[];
b) <data type><array name> [ ];
c) Both (a) and (b)
d) None of these
18. Declaring an array without ......... does not create an array object.
a) Declaration
b) Initialization
c) Instantiation
d) None of these
12. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
19. In java, initial value of array elements are specified into what brackets ? OR Which
type of braces is used to initialize data elements in 1-D array?
a) ()
b) {}
c) []
d) <>
20. In java, initial value for 1 – D array are separated using which symbol? OR In java,
by using which sign 1-D array is initialized to separate values of data elements in
braces() ?
a) – (dash)
b) : (colon)
c) ,(comma)
d) .(full stop)
13. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
21. Which of the following an example of data element of array?
a) int marks[ ]={50,60,70};
b) int marks[3]={50,60,70};
c) int marks[ ]=(50,60,70);
d) int marks[ ]={50;60;70};
22. Size of each row can be known using ..... property of 1 – D array.
a) Size
b) Length
c) Width
d) Row
14. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
23. In java, how can be array elements accessed using index for each dimension in?
a) ()
b) {}
c) []
d) <>
24. If ‘int marks[]={1,2,3,4,5};’ is defined in java what will be the value of marks[3] ?
a) 3
b) 2
c) 4
d) 5
15. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
25. In java, we can not specify both the size of ....... and ....... values of the array
elements simultaneously while declaring an array.
a) Class & Variable
b) Dimensions & Length
c) Initial & Value
d) Dimensions and Initial
26. Which of the following is not a right statement to declare an array named
marks in java ?
a) int marks[]=new int[3]
b) int marks[3]={50, 60, 70}
c) int[] marks=new int[3]
d) None of these
16. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
27. How many bytes are used to store the int marks[] = new int [5] array ?
a) 5 X 1 = 5
b) 5 X 2 = 10
c) 5 X 4 = 20
d) 5 X 8 = 40
28. Sort and fill() are methods of which of the following java class? OR We can use
various static methods provided by Java using which array class?
a) java.util.io
b) java.util.Arrays
c) java.io.Arrays
d) java.lang.Arrays
17. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
29. Which type of method is used to sort entire or part of array in java ?
a) fill()
b) sort()
c) show()
d) search()
30. In java, which method is used to fill the whole or partial array with specified value?
OR Which method of java.util.Arrays class is used to fill the whole or partial array
with specified value ?
a) sort()
b) set()
c) insert()
d) fill()
18. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
31. If you want to assigns value 7 to all elements of list array then which method is
used?
a) fill (ls,7)
b) fill(list, 7)
c) sort(list, 7)
d) fill(7)
32. What will done with command “fill (list, 2,6, 5);”?
a) Assigns array list value 5 to element list [5] to list [6 – 1]
b) Assigns array list value 6 to element list [2] to list[5 – 1]
c) Assigns array list value 5 to element list [2] to list[6 – 1]
d) None of these
19. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
33. In java, to search an element in an array, array class provides which type of
method?
a) sort()
b) fill()
c) binarySearch()
d) remove()
34. Which method in java, is used to search element by element comparison in a
serial fashion ?
a) Linear search
b) Find
c) Binary search
d) Look
21. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
35. If we write “int marks [][]=new int [5][3]” then which view shows the elements of
array in a table of 5 rows and 3 columns ?
a) Index view
b) Display view
c) Logical view
d) Physically view
36. In java, which view of array is stored in memory using contiguous memory?
a) Index view
a) Display view
b) Logical view
c) Physically view
22. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
37. Which braces is used in 2 D array using comma separated values of data elements ?
a) [] (square bracket)
b) () (simple bracket)
c) <> (angled bracket)
d) {} (curly bracket)
38. In the following statement for declaring two dimensional array of java 5 represent
what?
int marks[][]=new int[5][3];
a) Array size
b) Number of columns
c) Number of rows
d) Number of bytes
23. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
39. What is the size of second dimension in an array sale [5][12] ?
a) 5
b) 10
c) 12
d) 60
40. What is the size of second dimension in an array gseb [5] [3] ?
a) 3
b) 5
c) 15
d) 18
24. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
41. Which property is used with only array name returns the size of its first
dimension in java?
a) Byte
b) Length
c) Width
d) Size
42. How many integer values will be stored in the following array ?
int marks[][]=new int[4][4];?
a) 4
b) 8
c) 16
d) 644
2.
25. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
43. What expression sales. length return for an array sales[5][12] ?
a) 5
b) 10
c) 12
d) 60
44. When an array sales[5][12] is declared without specifying initial values, what is
the initial value of sales[0][0] ?
a) 0
b) Default value
c) 60
d) Compilation error
26. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
45. In statement “int marks [][]=new int [5][3]” occupy how many memory ?
a) 15 (5*3) integers that store 0 bytes
b) 15 (5*3) integers that store 60 (15*4) bytes
c) 15(5*3) integers that store 15 bytes
d) None of these
46. How many bytes of location are occupied by an array ‘b’ of int b[][]=new int[5][3];?
a) 3
b) 5
c) 15
d) 60
28. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
47. 1-D array of characters can be considered as a…………….. OR
…….. is considered as a sequence of characters
a) Character
b) String
c) Integer
d) Long
48. In java, string literals, a sequence of characters is enclosed between which sign?
a) ‘ ‘(single quote)
b) “ “(double quotes)
c) <>
d) /*….*/
29. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
49. Java supports two types of strings that are handled by which of the following class?
a) String
b) StringBuffer
c) character
d) Both (a) and (b)
50. Which operator can be used to concatenate a string in java?
a) =
b) +
c) &
d) *
30. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
51. In statement “String str1=new String(“I love Computer Subject”);” what do we call
str1?
a) String object
b) String class
c) Character class
d) Reference variable
52. In statement “String str1=new String(“I love Computer Subject”);” what do we call
“I love Computer Subject”?
a) String object
b) String class
c) Character class
d) Reference variable
31. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
53. Which of the following constructor is used for without arguments create a string
object with no character?
a) String(String literal)
b) String()
c) String (char ary[])
d) String (String strobj)
54. Which type of constructor creates a string object with its initial values using array
argument?
a) String(String literal)
b) String (String strobj)
c) String (char ary[])
d) string()
32. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
55. To make a string object which of the following constructors is used to create a string
object using 1-D ary argument starting at ary[start] with len number of character?
a) String(char ary[], int start, int len)
b) String(int start, int length)
c) String(int length, int start)
d) String(char ary[], int len)
56. Which constructor creates a string object which is same as object specified in
argument?
a) String(String literal)
b) String (String strobj)
c) String (char ary[])
d) string()
33. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
57. Separate memory is allocated when string objects are created using ………..operator.
a) Public
b) Private
c) Static
d) New
58. When two String objects are created using same string literals, memory space is not
allocated for …………… object.
a) zero
b) First
c) second
d) None of these
34. C
o
m
p
i
l
e
d
b
y
N
U
Z
H
A
T
M
E
M
O
N
59. What happen when we create a String object str1 and str2 without using new
operator?
a) Only str2 refer to different memory location.
b) Only str1 refer to different memory location.
c) str1 and str2 refer to the same instance as created for str1.
d) Both str1 and str2 refer to different memory location.
60. What happen when we create a String object st1 and st2 using new operator?
a) Only str2 refer to different memory location.
b) Only str1 refer to different memory location.
c) str1 and str2 refer to the same instance as created for str1.
d) Both str1 and str2 refer to different memory location.