ANSWER KEY (9) - 67 Que
ANSWER KEY (9) - 67 Que
ANSWER KEY (9) - 67 Que
Textbook Exercise
(1) Which of the following refer to the starting index value in arrays?
(A) 0 (B) 1 (C) Null (D) All of these
(2) What is the size of second dimension in an array sales [5] [12]?
(A) 5 (B) 12 (C) 60 (D) 10
(3) What will expression sales.length return for an array sales [5] [12]?
(A) 5 (B) 12 (C) 60 (D) 120
(4) When an array sales [5] [12] is declared without specifying initial values, what is the initial
value of sale [0] [0] ?
(A) 0 (B) default value (C) compilation error (D) 60
(5) What does ‘length’ refer to for an object of String class?
(A) attribute (B) method (C) class variable (D) class name
(6) If ‘str’ is the object of String class and its content is “Thank GOD”, then what is the value
of str.length()?
(A) 9 (B) 10 (C) 8 (D) 11
(7) What type of value is returned when we use get method of Calendar class with constant
DAY_OF_WEEK as an argument?
(A) int (B) char (C) string (D) boolean
12 (General) | March – 2015
(8) What is useful when same operations are to be performed on various elements of the
similar type in Java?
(A) Array (B) String (C) if.....then (D) while
(9) In Java which method is used to fill the whole or partial array with specified value?
(A) fill (B) sort (C) set (D) insert
(10) To make a string object which of the following constructers is used to create a string
object using 1-D ary argument starting at ary [start] with len number of characters ?
(A) String (char ar[], int start, int len) (B) String (int start, int length)
(C) String (int length, int start) (D) String (char ary[], int len)
(11) Which of the methods of string class returns an array of characters as bytes from invoking
string in Java?
(A) int length() (B) byte [ ] get bytes [ ]
(C) int bytes [ ] (D) get bytes [ ]
(12) What type of value is returned when we use get method of calendar class with constant
DAY_OF_WEEK as an argument in Java?
(A) int (B) char (C) string (D) boolean
(13) In Java, by using which sign 1-D array is initialized to separate values of data elements in
braces { } ?
(A) . (Full stop) (B) ; (Colon) (C) ; (Semi colon) (D) , (Comma)
(14) In Java, if ‘str’ is the object of string class and its content is ‘Thank God”, then what is the
value of str.length() ?
(A) 9 (B) 10 (C) 8 (D) 11
Page 1
(15) In Java, how can be array elements accessed using index for each dimension in?
(A) [ ] (B) ( ) (C) { } (D) < >
(16) In Java by using which of the following methods of comparing string returns ‘>0’ integer if
invoking string is greater than ?
(A) boolean equals (string str) (B) boolean compare to (string str)
(C) int compare to (string str) (D) int compare to ignore (string str)
(17) In Java array what is the process of making an object used to manage list of items?
(A) Declare an array object (B) Create an array object
(C) Both (A) and (B) (D) Define Object Method
12 (Science) | March – 2015
(18) Java supports two types of strings that are handled by two classes. Which are they?
(A) String, Buffer String (B) String, String Buffer
(C) String, String Literals (D) String, Buffer
(19) Which constructor can be used without arguments to create a string object with no
character?
(A) String ( ) (B) String { } (C) String < > (D) String [ ]
(20) Which of the following tasks are provided by string class?
(A) Appending string. (B) Extracting part of string.
(C) Splitting string into sub string (D) All of these
(21) Which of the following method returns number of characters in invoking string?
(A) int count() (B) int lencount() (C) int length() (D) int len ()
(22) Which of the following method is used to return a string converted to lower case?
(A) String to Lower Case () (B) String To Lower ()
(C) String () (D) String Lower ()
(23) Which of the following method is used to return a string after appending ‘str’ with the
invoking string ?
(A) String Append() (B) String concat (string str)
(C) String con Append () (D) String Append (string)
(24) Which class encapsulate both date and time and represent the value using milli-seconds
precision ?
(A) Preci class (B) Sec class (C) Date class (D) Time class
(25) Which of the following method is used to construct date object using current system time ?
(A) System() (B) SystemDate() (C) date() (D) Date()
(26) 1-D array is initialized using comma separated values of data elements using which
brackets?
(A) ( ) (B) < > (C) [ ] (D) { }
(27) Sort () and Fill () methods be used in Java by ..... class.
(A) java.util.Arrays (B) util.java.Arrays
(C) Java.Array.util (D) java.arrays.utils
(28) Which type of arrays are used to store tabular data in the form of rows and columns?
(A) 1-D (B) 2-D (C) 3-D (D) All of these
(29) If user wants to store 15 integer values through arrays, then which of the following is used?
(A) int m3 = new int [5] [3] (B) int m2 = new [5] [3]
(C) int m1 = new [15] [15] (D) int m4 = m4 int [2] [3]
(30) If ‘str’ is the object of string class and its content is “INDIAN FLAG”; then what is the value
of str.length()?
(A) 11 (B) 8 (C) 10 (D) 9
Page 2
(31) Which constant is used to display year of calendar?
(A) CAL (B) YEAR CAL (C) YEAR (D) MONTH
(32) Which constant is used to display Hour in 12-hour notation?
(A) 12 HOUR (B) HOUR 12 (C) Hour_of_day (D) HOUR
(33) Which constant is used to display Day number in the year?
(A) DAY_OF_YEAR (B) YEAR_DAY (C) YEAR (D) DAY_YEAR
(34) Vector is used to represent ..... dimensional data structure.
(A) 1 (B) 2 (C) 3 (D) 4
(35) What is useful to represent vector, matrix and other multi-dimensional data?
(A) String (B) Arrays (C) Char (D) Integer
(36) if int mark[ ]={70, 90, 20} is defined, then what will be value of marks[2] ?
(A) 20 (B) Error (C) 70 (D) 90
(37) The array variable starts its index value with what?
(A) Null (B) 2 (C) 1 (D) 0
Page 5