Chapter: Working with Array and String โข Total: 262 MCQs
MCQ 1Strings
In java,how many bytes are used to store charactres ?
A1
B3
C2
D4
Correct Answer: Option C
Note: GSEB Commerce Oct-2020
MCQ 2Date Class
In java library,which of the following packagesย is used to provid Date class and Calender class ?
Ajava.util
Bjava.util.Arrays
Cjava.io
Djava.lang
Correct Answer: Option A
Note: GSEB Commerce Oct-2020
MCQ 3Strings class methods
In string class,which of the following method is used to return a string after appending str with the invoking string ?
AString Add(String str)
BString Concat(String str)
CString toLowerCase( )
DString Append(String str)
Correct Answer: Option B
Note: GSEB Commerce Oct-2020
MCQ 4Strings class methods
Which operator is used, when string objects have Separate allocated memory and are identical?
Aliteral
Bnew
Ccreate
D(A)and(B)both
Correct Answer: Option B
Note: GSEB Commerce Oct-2020
MCQ 51-D Array
What will be the value of m(4) elements in the given statement?
int m[]={90,60,70,65,80}
A 65
B80
C60
D70
Correct Answer: Option B
Note: GSEB Commerce Oct-2020
MCQ 6Date Class
In date class, which method is used to construct date object using specify time in milliseconds elapsed since January 1, 1970 GMT?
ADate()
BLong getTime()
CDate ( long elapsedTime )ย
DString toString()
Correct Answer: Option B
Note: GSEB Commerce Oct-2020
MCQ 7Introduction of Array
In java, which of the following is an object used to mange list of items?
AArray
BForm
CWindow
DDocument
Correct Answer: Option A
Note: GSEB Commerce Oct-2020
MCQ 8Strings class methods
which object is using length method?
AArray
BString
CDate
DCalendarย
Correct Answer: Option B
Note: GSEB Commerce Oct-2020
MCQ 9Strings class methods
What will be the output of given java program?
{
String str1="india";
String str2="INDIA";
System.out.println(str1.compartTo(str2));
}
A0
B>0
C32
D-32
Correct Answer: Option C
Note: GSEB Commerce Oct-2020
MCQ 102-D Array
What will be the result of given java program?
{
ย ย ย int P[][]={{1,3,5,7},{2,4,6,8}};
ย ย ย System.out.println((P[0][1]-P[1][3]))
}
A-5
B-3
C5
D3
Correct Answer: Option A
Note: GSEB Commerce Oct-2020
MCQ 11Strings
WHICH STRING CONSTRUCTOR IS USED WITHOUT ARGUMENT TO CREATE A STRING OBJECT WITH NO CHARACTERS.
ASTRING()
BSTRING (CHAR ARY [])
CSTRING (SSO)
DSTRING (STR LITERAL)
Correct Answer: Option A
Note: null
MCQ 121-D Array
IN JAVA, TO SEARCH AN ELEMENT IN AN ARRAY, ARRAY CLASS PROVIDES WHICH TYPE OF METHOD.
AFILL()
BBINARYSEARCH()
CSORT()
DREMOVE()
Correct Answer: Option B
Note: null
MCQ 131-D Array
WHICH TYPE OF BRACE IS USED TO INITIALIZE DATA ELEMENT IN 1-D ARRAY.
A<>
B[]
C{}
D()
Correct Answer: Option C
Note: null
MCQ 14Strings class methods
IN JAVA,IF STR IS THE OBJECT OF STRING CLASS AND ITS CONTENT IS "HELLO" THEN WHAT IS THE VALUE OF STR.LENGTH().
A8
B7
C6
D5
Correct Answer: Option D
Note: null
MCQ 15Strings class methods
WHICH METHOD OF STRING CLASS IS USED TO RETURN A STRING WITH ALL CHARACTERS OF INVOKING STRING.
Aint length()
Bbyte[] getBytes()
Cchar indexAt(int index)
DString concate(String str)
Correct Answer: Option C
Note: null
MCQ 162-D Array
WE CAN USE VARIOUS STATIC METHODS PROVIDED BY JAVA USING WHICH ARRAY CLASS.
AJAVA.UTIL.ARRAYS
BJAVA.JO
CJAVA.LANG
DALL OF THESE
Correct Answer: Option A
Note: null
MCQ 17Date Class
WHICH METHOD OF DATE CLASS CONSTRUCTS DATE OBJECT USING CURRENT SYSTEM TIME IN JAVA?
ADATE & TIME()
BTODAYS DATE()
CDATE()
DNOW()
Correct Answer: Option C
Note: null
MCQ 182-D Array
WHAT IS THE SIZE OF SECOND DIMENSION IN AN ARRAY SALES? sales[5][12]
A12
B5
C60
D11
Correct Answer: Option A
Note: null
MCQ 19Introduction of Array
ARRAYS ARE USEFUL TO REPRESENT WHICH TYPE OF DATA IN JAVA?
AVECTOR
BMATRIX
CMULTI
DALL OF THESE
Correct Answer: Option D
Note: null
MCQ 20Introduction of Array
WHICH STEPS ARE FOLLOWED FOR THE PROCESS OF CREATION OF ARRAY IN JAVA.
ADECLARE AN ARRAY
BDECLARE AN ARRAY
CDECLARE AN ARRAY
DDECLARE AN ARRAY
Correct Answer: Option D
Note: null
MCQ 21Introduction of Array
What does length refer to for an object of String class?
AAttribute
BMethod
Cclass variable
Dclass name
Correct Answer: Option B
MCQ 22Introduction of Array
What do we call the basic data type which can store only one value at a time?
AScalar variable
BLocal variable
CStatic variable
DInstance variable
Correct Answer: Option A
Note: null
MCQ 23Introduction of Array
What do we call the data type that can be used to store a collection of more than one data values?
AScalar
BComposite
CConstructor
DBasic
Correct Answer: Option B
Note: null
MCQ 24Introduction of Array
Which of the following is a variable representing a collection of homogeneous type of elements?
AArray
BMethod
CClass
DObject
Correct Answer: Option A
Note: S-March-2020
MCQ 25Introduction of Array
โฆโฆโฆโฆโฆโฆ..is useful to represent vector, matrix, and other multi -dimensional data.
AArray
BMethod
CClass
DObject
Correct Answer: Option A
Note: null
MCQ 26Introduction of Array
โฆโฆโฆโฆโฆis a 1D data structure that can be used to store list of items in Java.
AVector
BMatrix
CComposite
DStatic
Correct Answer: Option A
Note: null
MCQ 27Introduction of Array
โฆโฆโฆโฆโฆ.is used to represent 2 โ D data structure.
AVector
BMatrix
CComposite
DStatic
Correct Answer: Option B
Note: null
MCQ 28Introduction of Array
Which of the following is useful when same operation is to be performed on various elements of similar type?
AArray
BConstructor
CMethod
DObject
Correct Answer: Option A
Note: null
MCQ 29Introduction of Array
How do we identify each element of array?
ABy an index position
BBy a pointer
CBy memory allocation
DAll of above
Correct Answer: Option A
Note: null
MCQ 30Introduction of Array
An index position of an array is associated with array โฆโฆโฆโฆโฆโฆ..
Aclass
Bvariable
CMethod
Dfunction
Correct Answer: Option B
Note: null
MCQ 31Introduction of Array
Creating an array is how many steps process?
ADeclare an array object
BCreate an array object
Cdeclare an array class
DBoth a and b
Correct Answer: Option D
Note: null
MCQ 32Introduction of Array
An array object can be created in how many ways?
AUsing new operator and specifying the size
BDirectly initializing the content of array
CSpecify the size
DBoth a and b
Correct Answer: Option D
Note: null
MCQ 33Introduction of Array
To declare 1โD array we use a pair of โฆโฆโฆโฆ..brackets after array name or after data type.
A[ ]
B{ }
C( )
D< >
Correct Answer: Option A
Note: null
MCQ 34Introduction of Array
Write down the various ways to create Array object named โmarksโ with size for 5 elements
Aint marks[ ]; marks = new int [5];
Bint marks [ ] = new int [5];
Cint [] marks = new int [5];
DAll of above
Correct Answer: Option D
Note: null
MCQ 35Introduction of Array
How many bytes are used to store the int marks[ ] = new int [5] array?
A5 X 4=20
B5 X 8=40
C5 X 2 =10
D5 X 1 =5
Correct Answer: Option A
Note: null
MCQ 36Introduction of Array
What specifies the position of an element in an array?
Aindex
Bserial
Cnumber
Dclass
Correct Answer: Option A
Note: null
MCQ 37Introduction of Array
If we declare โint marks[ ]=new int [5];โ array then what is its first and last element?
AFirst is marks[0] & Last is marks[4]
BFirst is marks[1] & Last is marks[5]
CFirst is marks[4] & Last is marks[0]
DFirst is marks[5] & Last is marks[1]
Correct Answer: Option A
Note: null
MCQ 38Introduction of Array
Index value of an array always starts from โฆโฆโฆโฆโฆโฆnumber.
A0 (zero)
B1
C2
D3
Correct Answer: Option A
Note: null
MCQ 39Introduction of Array
1-D array is initialized using โฆโฆโฆโฆ..sign to separate values of data elements in โฆโฆ.braces.
A, and { }
B; and { }
C, and ( )
D; and ( )
Correct Answer: Option A
Note: null
MCQ 40Introduction of Array
Which of the following an example of data element of array?
Aint marks[ ]={90,70,77};
Bint marks[3]={90,70,77};
Cint marks[ ]=(90,70,77);
Dint marks[ ]={90;70;77};
Correct Answer: Option A
Note: null
MCQ 41Introduction of Array
In java, we can not specify both the size of โฆโฆโฆ.. and โฆโฆโฆ.values of the array elements simultaneously while declaring an array.
Adimensions
Binitial
Cclass
DBoth a and b
Correct Answer: Option D
Note: null
MCQ 42Introduction of Array
Various array static methods provided by Java in โฆโฆโฆโฆโฆ.class.
Ajava.util.Arrays
Bjava.util.Array
Cjava.io.Arrays
Djava.util.io.Arrays
Correct Answer: Option A
Note: null
MCQ 43Introduction of Array
Which method to sort entire or part of array?
Asort( )
BShort( )
Cfill( )
Dunique( )
Correct Answer: Option A
Note: null
MCQ 44Introduction of Array
Which method is used to fill the whole or partial array with specified value?
Afill( )
Bsort( )
Cput( )
Dshort( )
Correct Answer: Option A
Note: null
MCQ 45Introduction of Array
If you want to assigns value 7 to all elements of list array then which method is used?
Afill (list, 7)
Bfill (ls,7)
Csort(list,7)
Dfill(7)
Correct Answer: Option A
Note: null
MCQ 46Introduction of Array
What will done with command โfill (list, 2,6,5);โ.
AAssigns array list value 5 to element list [2] to list[6-1]
BAssigns array list value 6 to element list [2] to list[5-1]
CAssigns array list value 5 to element list [5] to list[6-1]
DNone of these
Correct Answer: Option A
Note: null
MCQ 47Introduction of Array
To search an element in an array then array class provides which method?
ALinear search
BbinarySearch( )
Cbinary
Dsearch()
Correct Answer: Option B
Note: null
MCQ 48Introduction of Array
Which method in Java, is used to search element by element comparison in a serial fashion?
ALinear search
BbinarySearch( )
Cbinary
Dfind()
Correct Answer: Option A
Note: null
MCQ 49Introduction of Array
Which of the following arrays are used to store tabular data in the form of rows and columns?
A1D
B2D
Csingle
Dthree dimension
Correct Answer: Option B
Note: null
MCQ 50Introduction of Array
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?
ALogical view
BPhysically view
Cindex view
DDisplay view
Correct Answer: Option A
Note: null
MCQ 51Introduction of Array
In Java, which view of array is stored in memory using contiguous memory?
ALogical view
BPhysically view
Cindex view
DDisplay view
Correct Answer: Option B
Note: null
MCQ 52Introduction of Array
In statement โint marks [ ][ ]=new int [5][3]โ occupy how many memory?
A15 (5*3) integers that store 60 (15*4) bytes
B15 (5*3) integers that store 15 bytes
C15 (5*3) integers that store 30 (15*2) bytes
D15 (5*3) integers that store 0 bytes
Correct Answer: Option A
Note: S-March-2020
MCQ 53Introduction of Array
Java does not support โฆโฆโฆโฆโฆ.type of an array.
A1D
B2D
Cmulti-dimensional
DBoth b and c
Correct Answer: Option C
Note: null
MCQ 54Introduction of Array
To initialize 2-D array, all these initialized rows are to be enclosed in โฆโฆโฆโฆ. braces.
ACurly { }
BSquare [ ]
Ccircle ( )
Dangular < >
Correct Answer: Option A
Note: null
MCQ 55Introduction of Array
In 2-D array all elements in curly braces are separated by โฆโฆโฆโฆ..sign.
Acomma (,)
Bsemicolon (;)
Ccolon( : )
Ddot (.)
Correct Answer: Option A
Note: null
MCQ 56Introduction of Array
Size of each row can be known using โฆโฆโฆโฆโฆ.. property of 1-D array.
Alength
Bsize
Cwidth
Drow
Correct Answer: Option A
Note: null
MCQ 57Introduction of Array
Declaring an array without โฆโฆโฆโฆโฆ..does not create an array object.
Ainitialization
BDeclaration
CInstantiation
DNone of these
Correct Answer: Option A
Note: null
MCQ 58Introduction of Array
1-D array of characters can be considered as aโฆโฆโฆโฆโฆ..
Ainteger
Bcharacter
CString
Dlong
Correct Answer: Option C
Note: null
MCQ 59Introduction of Array
Java supports two .types of strings that are handled by which of the following class?
AString
BStringBuffer
Ccharacter
DBoth a and b
Correct Answer: Option D
Note: null
MCQ 60Introduction of Array
โฆโฆโฆโฆโฆconstructor is used without arguments create a string object with no character.
AString ( )
Bstr( )
Cstring( )
Dchar()
Correct Answer: Option A
Note: null
MCQ 61Introduction of Array
Which type of constructor creates a string object with its initial values using array argument?
AString (char ary[ ])
BString (char ary[ ], int start, int len)
CString (String strObj)
DString (string literal)
Correct Answer: Option A
Note: null
MCQ 62Introduction of Array
Which of the following constructor creates a String object using 1-D array argument starting at ary [start] with len number of character?
AString (char ary[ ])
BString (char ary[ ], int start, int len)
CString (String strObj)
DString (string literal)
Correct Answer: Option B
Note: null
MCQ 63Introduction of Array
Which of the following constructor creates a String object which is same as object specified in argument?
AString (char ary[ ])
BString (char ary[ ], int start, int len)
CString (String strObj)
DString (string literal)
Correct Answer: Option C
Note: null
MCQ 64Introduction of Array
Which of the following constructor creates a String object that refers to the literal specified in argument?
AString (char ary[ ])
BString (char ary[ ], int start, int len)
CString (String strObj)
DString (string literal)
Correct Answer: Option D
Note: null
MCQ 65Introduction of Array
When two String objects are created using same string literals, memory space is not allocated for โฆโฆโฆโฆโฆ object.
Asecond
Bfirst
Czero
Dnull
Correct Answer: Option A
Note: null
MCQ 66Introduction of Array
Separate memory is allocated when string objects are created using โฆโฆโฆโฆโฆโฆ..operator.
Anew
Bobj
Cstatic
Dprivate
Correct Answer: Option A
Note: null
MCQ 67Introduction of Array
What happen when we create a String object st1 and st2 without using new operator?
Ast1 and st2 refer to the same instance as created for st1.
BBoth st1 and st2 refer to different memory location.
COnly st2 refer to different memory location.
DOnly st1 refer to different memory location.
Correct Answer: Option A
Note: null
MCQ 68Introduction of Array
What happen when we create a String object st1 and st2 using new operator?
Ast1 and st2 refer to the same instance as created for st1.
BBoth st1 and st2 refer to different memory location.
COnly st2 refer to different memory location.
DOnly st1 refer to different memory location.
Correct Answer: Option B
Note: null
MCQ 69Introduction of Array
In statement โString st1=new String(โI love Indiaโ);โ what do we call st1?
AReference variable
BString object
CString class
Dcharacter class
Correct Answer: Option A
Note: null
MCQ 70Introduction of Array
In statement โString st1=new String(โI love Indiaโ);โ what do we call โI love Indiaโ?
AString Object
Breference variable
Cstring class
Dcharacter class
Correct Answer: Option A
Note: null
MCQ 71Introduction of Array
Which class provides methods to compare strings, find length of string, combining strings, obtaining sub strings, converting strings, splitting strings, searching for character or pattern in string etc?
AString Class
BCharacter class
CBinary class
Dbytecode class
Correct Answer: Option A
Note: null
MCQ 72Introduction of Array
Which method returns an array of characters as byte from invoking string?
Aint length( )
Bbyte [ ] getBytes( )
CString(Bytes)
DgetBytes( )
Correct Answer: Option B
Note: null
MCQ 73Introduction of Array
Which of the following string class method returns number of characters in invoking string?
Aint length( )
Bint LENGTH( )
Cint Length( )
DFloat int length( )
Correct Answer: Option A
Note: null
MCQ 74Introduction of Array
Date and Calendar class is provided in which of the following package?
Ajava.class
Bjava.util
Cjava.dc
Djava.dateclass
Correct Answer: Option B
Note: null
MCQ 75Introduction of Array
Which class encapsulate both date and time and represents the value using milliseconds precision?
ADate
BCalendar
Cdate
DDATE
Correct Answer: Option A
Note: null
MCQ 76Introduction of Array
Which of the following Date method constructs Date object using current system time?
ADate (long ())
BDate( )
CDate (cur( ))
DDate [date()]
Correct Answer: Option B
Note: null
MCQ 77Introduction of Array
Which method returns a string representing date and time of invoking object?
Along getTime( )
BString toString( )
CString( )
DDate (Long ElapsedTime)
Correct Answer: Option B
Note: null
MCQ 78Introduction of Array
Which method sets new date and time of an object using elapsed time?
Avoid setTime(long elapsedTime)
Blong getTime( )
CDate( )
DDate(elapsed time)
Correct Answer: Option A
Note: null
MCQ 79Introduction of Array
Which method constructs Date object using specified time in milliseconds elapsed since January 1, 1970 GMT?
ADate (long elapsedTime)
BDate ( )
CDate(time)
DTime(Date)
Correct Answer: Option B
Note: null
MCQ 80Introduction of Array
Which method returns nimber of milliseconds since January 1, 1970 GMT?
Along getTime( )
BString toString( )
CDate( )
DDate(Time)
Correct Answer: Option A
Note: null
MCQ 81Introduction of Array
Which class can be used to extract detailed calendar information like year, month, minute etc.
ADate class
BCalendar class
Ccalendar class
DCALENDAR class
Correct Answer: Option B
Note: null
MCQ 82Introduction of Array
Which is the subclass of Calendar class?
AGregorianCalendar
Bgregoriancalendar
Ccal
Dcalendargregorian
Correct Answer: Option A
Note: null
MCQ 83Introduction of Array
What is the set value of statement โcalendar.set(Calendar.DATE,20);โ?
Aset 20 as date of current month
BSet date to 20 of system month
Cset date above 20 of system month
Dset date below 20 of system month
Correct Answer: Option A
Note: null
MCQ 84Introduction of Array
Which constant of Calendar class set day of calendar month?
ADATE
BDate ( )
Cdate ( )
DToday()
Correct Answer: Option A
Note: null
MCQ 85Introduction of Array
Which constant of Calendar class set minutes?
AMinute( )
BMINUTE
CMin( )
Dminute( )
Correct Answer: Option B
Note: null
MCQ 86Introduction of Array
Which constant of Calendar class set seconds?
ASECOND
BSecond ( )
Csecond( )
Dmillisecond( )
Correct Answer: Option A
Note: null
MCQ 87Introduction of Array
Which constant of Calendar class set week number within the month?
AWEEK_OF_MONTH
BWEEK.OF.MONTH
Cweekof month
Dweek-of-month
Correct Answer: Option A
Note: null
MCQ 88Introduction of Array
Which constant of Calendar class set week number within the year?
AWEEK_OF_YEAR
BWEEK.OF.YEAR
Cweekofyear
Dweek-of-year
Correct Answer: Option A
Note: null
MCQ 89Calender class
Which constant of Calendar class set day number in the year (1 for the first day)?
ADAY.OF.YEAR
BDAY_OF_YEAR
Cday-of-year
Ddayofyear
Correct Answer: Option B
Note: G-March-2022
MCQ 90Introduction of Array
Which constant of Calendar class set Day number within a week (1 for Sunday, 7 for Saturday)?
ADAY_OF_WEEK
BWEEK_OF_DAY
Cweek-of-week
Dday-of-week
Correct Answer: Option A
Note: null
MCQ 91Introduction of Array
Which constant of Calendar class is similar as DATE constant?
ADAY_OF_MONTH
BWEEK_OF_MONTH
Cday-of-month
Dweek-of-month
Correct Answer: Option A
Note: null
MCQ 92Introduction of Array
Method toString( ) returns answer in which data type?
Achar
BString
Cint
Dfloat
Correct Answer: Option A
Note: null
MCQ 93Introduction of Array
Method getTime( )returns answer in which data type?
Along
Bfloat
Cint
DString
Correct Answer: Option A
Note: null
MCQ 94Introduction of Array
Which constant of Calendar class set 0 (Zero) for AM and 1 for PM?
AAM.PM (
BAM_PM
Cam_pm
Dam.pm
Correct Answer: Option B
Note: null
MCQ 95Introduction of Array
In which format GregorianCalendar class constructor takes Date values?
AMM-DD-YYYY
BYYYY-MM-DD
CYY-MM-DD
DMM-DD-YY
Correct Answer: Option B
Note: null
MCQ 96Introduction of Array
What is the output of statement โDate( );โ?
ACurrent system date and time
BOnly date
COnly time
Dset date and time
Correct Answer: Option A
Note: null
MCQ 97Introduction of Array
If Today is โTuesdayโ then what is the output of statement โc1.get(Calendar.DAY_OFWEEK);โ?
A3
B2
C1
D4
Correct Answer: Option A
Note: null
MCQ 98Introduction of Array
What is the output of statement โSystem.out.println(str1.equals(str2) );โ if content of srt1 and str2 is โIndiaโ?
ATRUE
BFALSE
CYes
DNo
Correct Answer: Option A
Note: null
MCQ 99Introduction of Array
What is the size of second dimension in an array gseb [5] [3]?
A15
B3
C5
D18
Correct Answer: Option B
Note: null
MCQ 100Introduction of Array
Which of the following constructor is used for without argument create a string object with no character?
AString[ ]
BString{ }
CString ( )
DString< >
Correct Answer: Option A
Note: null
MCQ 101Introduction of Array
Which of the following string class method returns true if invoking string is same as str?
ABoolean Equal (string str)
BBoolean equals ( String str)
CBoolean eq (string str)
DBoolean Eq (string str)
Correct Answer: Option B
Note: null
MCQ 102Introduction of Array
Which of the following is useful to represent vector, matrix and other multidimensional data?
AArray
BVariable
CElement
DTag
Correct Answer: Option A
Note: null
MCQ 103Introduction of Array
Which of the following refer to the starting index value in arrays?
A0 (zero)
B1
Cnull
DAll of these
Correct Answer: Option A
Note: null
MCQ 104Introduction of Array
If int marks[ ] = {1,2,3,4,5); is defined in Java then what will be the value of marks[3]?
A4
B3
C2
D5
Correct Answer: Option A
Note: null
MCQ 105Introduction of Array
Which of the following is not a right statement to declare an array named marks in Java?
Aint marks[ ]=new int [3]
Bint [ ] marks = new int[3]
Cint marks[3] = {50,60,70}
Dint marks[ ]= {10,20,30}
Correct Answer: Option C
Note: null
MCQ 106Introduction of Array
In Java, which of the following methods of string class returns a string after appending str with the invoking string?
Achar indexAt(int index)
Bbyte[ ] getBytes( )
CString concat (String str)
DString append(String str
Correct Answer: Option C
Note: null
MCQ 107Introduction of Array
In Java, if โstrโ is the object of string class and its content is @Thank GOD@, then what is the value of str.length( )?
A9
B10
C11
D8
Correct Answer: Option C
Note: null
MCQ 108Introduction of Array
Which method of java.util.Arrays class is used to fill the whole or partial array with specified value?
Afill( )
Bsort( )
Cput( )
Dprint( )
Correct Answer: Option A
Note: null
MCQ 109Introduction of Array
Which of the following symbol signifies the start and end of a JavaScript block?
Asemicolon
Bsquare bracket
Ccurly bracket
Dround bracket
Correct Answer: Option C
Note: null
MCQ 110Introduction of Array
In Java, int compareto(String str) method returns which value if invoking string is equal to str?
A0 zero
B> 0
C<0
D-1
Correct Answer: Option A
Note: null
MCQ 111Introduction of Array
In Java, which constant of calender class will display day number in the year?
ADAY OF YEAR
BDAY
CDAY_OF_MONTH
DDAY OF WEEK
Correct Answer: Option A
Note: G-March-2022
MCQ 112Introduction of Array
In Java, which of the following methods calls sort elements of array โlistโ from list [1] to list [5-1] ?
Asort (list)
Bjava.sort (list)
Cjava.util.Arrays.sort (list, 1, 5)
Djava.util.sort (list, 5)
Correct Answer: Option C
Note: G-March-2022
MCQ 113Introduction of Array
In Java, which property of 1-D array is used to know size of each row?
Asize
Blength
Csort
Dfill
Correct Answer: Option B
Note: G-March-2022
MCQ 114Introduction of Array
In Java, how many integer values can be stored using following array? int marks [] [] = new int [4] [4]; .
A4
B8
C16
D64
Correct Answer: Option C
Note: G-March-2022
MCQ 115Introduction of Array
In Java, which of the following is a proper example of initializing 1-D array? (i) int marks [3]= {90,100,110}; (i) int marks[] = {90,100,110}; (iii) int[] marks = {90,100,110};
Aonly (i)
B(i) and (ii)
C(i) and (iii)
D(ii) and (iii)
Correct Answer: Option D
Note: G-March-2022
MCQ 116Introduction of Array
Which of the following methods of string class of Java returns true if invoking string is same as str after ignoring case?
Aboolean equals ignore case (string str)
Bint compare To (string str)
Cboolean equals (string str)
Dint length()
Correct Answer: Option A
Note: G-March-2022
MCQ 117Introduction of Array
In Java, which of the following are useful when same operations are to be performed on various elements of the similar type?
AOperators
BArrays
CFiles
DComments
Correct Answer: Option B
Note: G-March-2022
MCQ 118Introduction of Array
In Java, how many arguments are required to fill partial array?
A2
B3
C4
D5
Correct Answer: Option C
Note: G-March-2022
MCQ 119Introduction of Array
Which kind of variables are of basic data types and can store only one value at a time?
AArray variables
B1-D variables
C2-D variables
DScalar variables
Correct Answer: Option D
Note: G-March-2022
MCQ 120Introduction of Array
In Java which method of date class returns number of milliseconds since January1, 1970 GMT?
ADate (long elapsedTime)
Blong getTime ( )
CDate ( )
Dvoid setTime (long elapsedTime)
Correct Answer: Option B
Note: G-March-2022
MCQ 121Introduction of Array
Which of the following is a one-dimensional data structure that can be used to store list of items like characters, numbers?
Avector
Bmatrix
Crow
Dcolumn
Correct Answer: Option A
Note: G-May-2019
MCQ 122Introduction of Array
Which of the following methods does element by element comparison in a serial fashion?
ABinary Search ( )
BLinear Search
CRandom Search
DNumerical Search
Correct Answer: Option B
Note: G-May-2019
MCQ 123Introduction of Array
In Java, what is the size of row in following array? int marks [ ] [ ] = new int [4] [3);
A3
B12
C7
D4
Correct Answer: Option B
Note: G-May-2019
MCQ 124Introduction of Array
In 1-D array of Java, which of the following symbols is used to separate elements in a pair of { } braces?
AComma
BPlus
CUnderscore
DSpace
Correct Answer: Option A
Note: G-May-2019
MCQ 125Introduction of Array
In Java, which of the following are useful when same operations are to be performed on various elements of the similar type?
AArrays
BVariables
CCharacters
DString
Correct Answer: Option A
Note: G-May-2019
MCQ 126Introduction of Array
How many arguments are required to fill partial array in Java?
A3
B4
C2
D1
Correct Answer: Option B
Note: G-May-2019
MCQ 127Introduction of Array
In Java, which of the following classes contains methods like sort ( ) and fill ( )?
Ajava.lang
BArrays.java
Cjava.util.Arrays
Dutil.Arrays
Correct Answer: Option C
Note: G-May-2019
MCQ 128Introduction of Array
Which of the following constructors can create a string object with its initial value using โaryโ argument?
Astring ( )
Bstring (string strobj)
Cstring (string literal)
Dstring (char ary[ ])
Correct Answer: Option D
Note: G-May-2019
MCQ 129Introduction of Array
In 1-D array of Java, which property is used to know size of each row?
Asize
Bfloat
Clength
Dwidth
Correct Answer: Option C
Note: G-May-2019
MCQ 130Introduction of Array
What will be the value of the element J [2] in the following array in Java? int J [ ] = {70, 31, 10, 45, 50};
A31
B2
C10
DJ [2]
Correct Answer: Option C
Note: G-May-2019
MCQ 131Introduction of Array
Which of the following is the correct syntax to declare Array in Java?
A< array name>[ ]< data type>;
B< array name> < data type> [ ];
C< array name> < class name>[];
D< data type> < array name> [ ] ;
Correct Answer: Option D
Note: G-May-2019,S-March-2020
MCQ 132Introduction of Array
In Java, which of the following is used to represent a collection of homogeneous type of elements?
Afunction
Barray
Cprocedure
Dswitch
Correct Answer: Option B
Note: G-March-2019
MCQ 133Introduction of Array
Which method compares elements by elements in a serial fashion?
ARandom search
BLinear search
CBoth A and B
DNone of the given
Correct Answer: Option B
Note: null
MCQ 134Introduction of Array
Which method is used to set the value of the field constants of calendar class?
AGet
Bget
CSet
Dset
Correct Answer: Option D
Note: null
MCQ 135Introduction of Array
Which of the following action will be performed with command java.util.Arrays.fill(list, 5)?
AThe first five elements of array will be displayed
BValue 5 will be assigned to all elements of list array.
CValue 0 will be assigned in the 5th element of list array.
DNone of the given
Correct Answer: Option B
Note: null
MCQ 136Introduction of Array
Which of the following statement is invalid for declaring an array with name height?
Aint height [ ]= new int[7]
Bint[] height = new int[7]
Cint height[] = int [7]
DNone of the given
Correct Answer: Option C
Note: null
MCQ 137Introduction of Array
The length property returns______________ for 2D array.
Anumber of rows
Bnumber of columns
Cnumber of elements
Dnumber of memory bytes
Correct Answer: Option A
Note: null
MCQ 138Introduction of Array
What does 5 indicate in marks [5]?
ATotal elements
BValue of an element
CMemory locations occupied by the variable
DSubscript/index of an element
Correct Answer: Option D
Note: null
MCQ 139Introduction of Array
Which method returns a string with all characters of invoking string converted to lowercase?
AString toLowerCase()
BString toLower()
CLowercase()
DAll of the given
Correct Answer: Option A
Note: null
MCQ 140Introduction of Array
Which of the following statement is true for an array int marks [][] = new int[5] [3]:?
ALogical view of array elements is a table of 5 rows and 3 columns.
BPhysically, array elements are stored in memory using contiguous memory location for 15 integers.
CThis array occupies 60 bytes in memory.
DAll of the given
Correct Answer: Option D
Note: null
MCQ 141Introduction of Array
Which of the following class handles string in Java?
Astring
BstringBuffer
CBoth A and B
DNone of the given
Correct Answer: Option C
Note: null
MCQ 142Introduction of Array
In Java, length is a _____________ with string object.
Amethod
Battribute
Cproperty
DAll of the given
Correct Answer: Option A
Note: null
MCQ 143Introduction of Array
When an array element is searched using binarysearch() method, __________ value is returned if an element is not found.
A1
B-1
C0
Derror message
Correct Answer: Option B
Note: null
MCQ 144Introduction of Array
Which of the following statement is true for an array int marks[]=new int[3]?
AIt is an array to store three integer values.
BThe name of an array is marks.
CThe array will occupy 6 bytes in memory.
DBoth A and
Correct Answer: Option D
Note: null
MCQ 145Introduction of Array
Which of the following will be displayed when invoking string is same as object Str?
AReturns error message
BReturns wrong message
CReturns false
DReturns true
Correct Answer: Option D
Note: null
MCQ 146Introduction of Array
Which of the following statement is invalid for declaring an array with name height?
Aint height [ ] = new int[7]
Bint [ ] height = new int[7]
Cint height [ ] = int [7]
DNone of the given
Correct Answer: Option C
Note: null
MCQ 147Introduction of Array
In which of the following braces, the subscript of an array is enclosed?
A[ ]
B( )
C{ }
D<>
Correct Answer: Option A
Note: null
MCQ 148Introduction of Array
What will be stored in an array marks [2] if int marks[]= (10, 20, 30, 40, 50)?
A10
B20
C30
D40
Correct Answer: Option C
Note: null
MCQ 149Introduction of Array
Which method returns a string with all characters of invoking string converted lowercase?
AString toLowerCase()
BString toLower()
CLowercase()
DAll of the given to
Correct Answer: Option A
Note: null
MCQ 150Introduction of Array
Which of the following operations can be performed on array?
Acompare two arrays
Bcopy all the elements of one array to another
Csearch for a specified element in array
DAll of the given
Correct Answer: Option D
Note: null
MCQ 151Introduction of Array
Vector array can be used to store list of items like_________
Acharacters
Bnumbers
CA or B
DAll of the given
Correct Answer: Option C
Note: null
MCQ 152Introduction of Array
__________________ method returns character at index position from the invoking string, Here index is considered from 0.
Abyte getbyte ()
Bchar indexAt (int index)
Cvoid getchars (int fromIndx, int toIndx, char target [], int targetIndx)
Dstring concat (string str)
Correct Answer: Option B
Note: null
MCQ 153Introduction of Array
When an array element is searched using binarySearch () methods, which value is returned if an element is found?
A1
B-1
C0
DIndex position
Correct Answer: Option D
Note: null
MCQ 154Introduction of Array
Which of the following syntax is valid for declaring an array?
Aint marks[] = int[15]:
Bint marks[] = new int [15]:
CBoth A and B
DNone of the given
Correct Answer: Option C
Note: null
MCQ 155Introduction of Array
Which value will be returned if invoking string is equal to str?
A0
B1
C-1
DNone of the given
Correct Answer: Option A
Note: null
MCQ 156Introduction of Array
Which of the following is displayed in the pair of square brackets "[ ]" that are used with array name?
AIndex
BSubscript
CSize of an array
DAll of the given
Correct Answer: Option D
Note: null
MCQ 157Introduction of Array
What does array height [1] indicate?
AThe first element of height array
BThe second element of height array
CThe value of variable height is 1
DAll of the given
Correct Answer: Option B
Note: null
MCQ 158Introduction of Array
Which of the following library provides Date class in Java?
Ajava.util
Bjava.utilities
CJava.date
DJava.char
Correct Answer: Option A
Note: null
MCQ 159Introduction of Array
How many numbers of dimensions can be used to create a two-dimensional array?
A[10] [10]
B[3] [3]
C[256] [256]
DThere is no limit.
Correct Answer: Option D
Note: null
MCQ 160Introduction of Array
Which of the following constant of calendar class displays how in 12 hour notation?
AHOUR
BHOUR12
C12HOUR
DHOUR 12
Correct Answer: Option A
Note: null
MCQ 161Introduction of Array
In Java 2-D array, each row is considered as ___________________
A1D array element
Bdimension
Ccolumn
DNone of the given
Correct Answer: Option A
Note: null
MCQ 162Introduction of Array
77. In Java, to save the space, an array of ________________ should be used instead of an array of characters if the characters are ASCII.
Astring
Bbytes
C3-D
DNone of the given
Correct Answer: Option B
Note: null
MCQ 163Introduction of Array
In which form the 2-D array stores data?
ARow and column form
BTabular form
CA or B
DNone of the given
Correct Answer: Option C
Note: null
MCQ 164Introduction of Array
Which method is used to fill the whole or partial array with specified value?
Aadd
Bfill
Cinsert
DNone of the given
Correct Answer: Option B
Note: null
MCQ 165Introduction of Array
Which method is used to get the number of characters in invoking string?
Aint strlength( )
Bint length( )
Cint total( )
Dint count( )
Correct Answer: Option B
Note: null
MCQ 166Introduction of Array
Which sign is used to enclose the string in Java?
Aโ โ
B" โ
C# #
D$ $
Correct Answer: Option B
Note: null
MCQ 167Introduction of Array
An index or subscript of an array refers to which of the following?
AValue of variable
BThe position of an element in an array
CA or B
DNone of the given
Correct Answer: Option B
Note: null
MCQ 168Introduction of Array
Which braces are used to initialize values to the elements of a single dimensional array?
A{ }
B[ ]
C< >
D( )
Correct Answer: Option A
Note: null
MCQ 169Introduction of Array
Which of the following method construct Date object using current system time?
ADate & Time ( )
BDate{ }
CDate( )
DNow( )
Correct Answer: Option C
Note: null
MCQ 170Introduction of Array
Arrays are useful to represent_____________ data.
Avector
Bmatrix
Cmulti-dimensional
DAll of the given
Correct Answer: Option D
Note: null
MCQ 171Introduction of Array
With an array variable length is _______________________ of array.
Amethod
Ban attribute
Cproperty
DB or C
Correct Answer: Option D
Note: null
MCQ 172Introduction of Array
Which method is used to set the value of the field constants of calendar class?
AGet
Bget
CSet
Dset
Correct Answer: Option D
Note: null
MCQ 173Introduction of Array
How many values will be stored in the memory of an array int height][]=new int [4] [3]; ?
A4
B12
C3
D7
Correct Answer: Option B
Note: null
MCQ 174Introduction of Array
Which type of data can be presented using an array in Java?
AVector
BMatrix
CMulti-dimensional
DAll of the given
Correct Answer: Option D
Note: null
MCQ 175Introduction of Array
Which constructor in Java creates a string object which is same as object specified in argument?
AString()
BString(String literal)
CString(String Strobj)
DNone of the given
Correct Answer: Option C
Note: null
MCQ 176Introduction of Array
How many bytes will be occupied in a memory by an array int marks! ]= new int[3]?
A3
B6
C12
D18
Correct Answer: Option C
Note: null
MCQ 177Introduction of Array
Which of the following property is used to get the number of elements in 1-D array?
Alength
Bsize
Cnumber
Dtotal
Correct Answer: Option A
Note: null
MCQ 178Introduction of Array
How many elements of an array will be sorted by method java.util.Arrays.sort(list 1, 5)?
Alist[1] and list[5]
BFrom list[1] to list[5]
CFrom list[1] to list[5-1]
DFrom list[0] to list[5-1]
Correct Answer: Option C
Note: null
MCQ 179Introduction of Array
Which package of Java library provides calendar class?
Ajava.cal
Bjava.lib.cal
CJava.util
Djava.util.cal
Correct Answer: Option C
Note: null
MCQ 180Introduction of Array
In Java array, ____________ are used while using length method with string object.
A[ ]
B( )
C{ }
D<>
Correct Answer: Option B
Note: null
MCQ 181Introduction of Array
When two string objects are created using the same string literals ______________
Amemory space is not allocated for second object.
Bboth objects refers to same memory location.
CBoth A and B
Dboth objects are allocated separate memory space.
Correct Answer: Option C
Note: null
MCQ 182Introduction of Array
_________________ method returns true, if invoking string is same as str.
Aboolean equals (string str)
Bboolean equalsIgnoreCase (string str)
Cint compareTo (string str)
Dint compareTolgnoreCase (string str)
Correct Answer: Option A
Note: null
MCQ 183Introduction of Array
Whose size is indicated by the first square bracket in the statement: int height [ ][ ] = new int [6] [4]?
AMemory
BCell
CColumn
DRow
Correct Answer: Option D
Note: null
MCQ 184Introduction of Array
In which of the following braces, the subscript of an array is enclosed?
A( )
B{ }
C[ ]
D< >
Correct Answer: Option C
Note: null
MCQ 185Introduction of Array
_________________ method in Java returns an array of characters as bytes from invoking string.
Abyte[ ] getBytes( )
BgetBytes( )
CsetByte[ ]
Dbyte[ ]
Correct Answer: Option A
Note: null
MCQ 186Introduction of Array
With which number an index value start in an array?
A1
B-1
C0
DNone of the given
Correct Answer: Option C
Note: null
MCQ 187Introduction of Array
___________constructor in Java create a string object with no character.
AString( )
BString(null)
CString(char ary[ ])
DAll of the given
Correct Answer: Option A
Note: null
MCQ 188Introduction of Array
Which method is used to fill the whole or partial array with specified value?
Aadd
BInsert
Cfill
DAll of the given
Correct Answer: Option C
Note: null
MCQ 189Introduction of Array
Which of the following constructor creates a string object with its initial value using ary argument?
Astring (string)
Bstring (string string)
Cstring (int string)
Dstring (char ary[ ])
Correct Answer: Option D
Note: null
MCQ 190Introduction of Array
In Java, separate memory is allocated when string objects are created using operator even if strings are identical.
Aliteral
Bnew
Cstr
Dconstructor
Correct Answer: Option B
Note: null
MCQ 191Introduction of Array
______________ method returns character at index position from the invoking string index is considered from 0.
Aint length()
Bchar indexAt (int index)
Cbyte getBytes()
Dstring toLowerCase()
Correct Answer: Option B
Note: null
MCQ 192Introduction of Array
String class in Java does not provide method for ____________________
Areversing strings
Bobtaining substring
Cconverting strings
Dappending string
Correct Answer: Option A
Note: null
MCQ 193Strings
In java,how many bytes are used to store charactres ?
A1
B3
C2
D4
Correct Answer: Option C
Note: GSEB Commerce Oct-2020
MCQ 194Strings class methods
In string class,which of the following method is used to return a string after appending str with the invoking string ?
AString Add(String str)
BString Concat(String str)
CString toLowerCase( )
DString Append(String str)
Correct Answer: Option B
Note: GSEB Commerce Oct-2020
MCQ 195Strings class methods
Which operator is used, when string objects have Separate allocated memory and are identical?
Aliteral
Bnew
Ccreate
D(A)and(B)both
Correct Answer: Option B
Note: GSEB Commerce Oct-2020
MCQ 196Date Class
In date class, which method is used to construct date object using specify time in milliseconds elapsed since January 1, 1970 GMT?
ADate()
BLong getTime()
CDate ( long elapsedTime )รย
DString toString()
Correct Answer: Option B
Note: GSEB Commerce Oct-2020
MCQ 197Introduction of Array
In java, which of the following is an object used to mange list of items?
AArray
BForm
CWindow
DDocument
Correct Answer: Option A
Note: GSEB Commerce Oct-2020
MCQ 198Introduction of Array
Which of the following is a variable representing a collection of homogeneous type of elements?
AArray
BMethod
CClass
DObject
Correct Answer: Option A
Note: S-March-2020
MCQ 199Calender class
Which constant of Calendar class set day number in the year (1 for the first day)?
ADAY.OF.YEAR
BDAY_OF_YEAR
Cday-of-year
Ddayofyear
Correct Answer: Option B
Note: G-March-2022
MCQ 200Introduction of Array
In Java, which constant of calender class will display day number in the year?
ADAY OF YEAR
BDAY
CDAY_OF_MONTH
DDAY OF WEEK
Correct Answer: Option A
Note: G-March-2022
MCQ 201Introduction of Array
In Java, which property of 1-D array is used to know size of each row?
Asize
Blength
Csort
Dfill
Correct Answer: Option B
Note: G-March-2022
MCQ 202Introduction of Array
In Java, how many integer values can be stored using following array? int marks [] [] = new int [4] [4]; .
A4
B8
C16
D64
Correct Answer: Option C
Note: G-March-2022
MCQ 203Introduction of Array
Which of the following methods of string class of Java returns true if invoking string is same as str after ignoring case?
Aboolean equals ignore case (string str)
Bint compare To (string str)
Cboolean equals (string str)
Dint length()
Correct Answer: Option A
Note: G-March-2022
MCQ 204Introduction of Array
In Java, how many arguments are required to fill partial array?
A2
B3
C4
D5
Correct Answer: Option C
Note: G-March-2022
MCQ 205Introduction of Array
Which kind of variables are of basic data types and can store only one value at a time?
AArray variables
B1-D variables
C2-D variables
DScalar variables
Correct Answer: Option D
Note: G-March-2022
MCQ 206Introduction of Array
In Java which method of date class returns number of milliseconds since January1, 1970 GMT?
ADate (long elapsedTime)
Blong getTime ( )
CDate ( )
Dvoid setTime (long elapsedTime)
Correct Answer: Option B
Note: G-March-2022
MCQ 207Introduction of Array
Which of the following is a one-dimensional data structure that can be used to store list of items like characters, numbers?
Avector
Bmatrix
Crow
Dcolumn
Correct Answer: Option A
Note: G-May-2019
MCQ 208Introduction of Array
Which of the following methods does element by element comparison in a serial fashion?
ABinary Search ( )
BLinear Search
CRandom Search
DNumerical Search
Correct Answer: Option B
Note: G-May-2019
MCQ 209Introduction of Array
In Java, what is the size of row in following array? int marks [ ] [ ] = new int [4] [3);
A3
B12
C7
D4
Correct Answer: Option B
Note: G-May-2019
MCQ 210Introduction of Array
In 1-D array of Java, which of the following symbols is used to separate elements in a pair of { } braces?
AComma
BPlus
CUnderscore
DSpace
Correct Answer: Option A
Note: G-May-2019
MCQ 211Introduction of Array
In Java, which of the following are useful when same operations are to be performed on various elements of the similar type?
AArrays
BVariables
CCharacters
DString
Correct Answer: Option A
Note: G-May-2019
MCQ 212Introduction of Array
How many arguments are required to fill partial array in Java?
A3
B4
C2
D1
Correct Answer: Option B
Note: G-May-2019
MCQ 213Introduction of Array
In Java, which of the following classes contains methods like sort ( ) and fill ( )?
Ajava.lang
BArrays.java
Cjava.util.Arrays
Dutil.Arrays
Correct Answer: Option C
Note: G-May-2019
MCQ 214Introduction of Array
In 1-D array of Java, which property is used to know size of each row?
Asize
Bfloat
Clength
Dwidth
Correct Answer: Option C
Note: G-May-2019
MCQ 215Introduction of Array
What will be the value of the element J [2] in the following array in Java? int J [ ] = {70, 31, 10, 45, 50};
A31
B2
C10
DJ [2]
Correct Answer: Option C
Note: G-May-2019
MCQ 216Date Class
In java library,which of the following packagesย is used to provid Date class and Calender class ?
Ajava.util
Bjava.util.Arrays
Cjava.io
Djava.lang
Correct Answer: Option A
Note: GSEB Commerce Oct-2020
MCQ 217Strings class methods
which object is using length method?
AArray
BString
CDate
DCalendarย
Correct Answer: Option B
Note: GSEB Commerce Oct-2020
MCQ 218Strings class methods
What will be the output of given java program?
{
String str1="india";
String str2="INDIA";
System.out.println(str1.compartTo(str2));
}
A0
B>0
C32
D-32
Correct Answer: Option C
Note: GSEB Commerce Oct-2020
MCQ 219Strings class methods
IN JAVA,IF STR IS THE OBJECT OF STRING CLASS AND ITS CONTENT IS "HELLO" THEN WHAT IS THE VALUE OF STR.LENGTH().
A8
B7
C6
D5
Correct Answer: Option D
Note: null
MCQ 2202-D Array
WHAT IS THE SIZE OF SECOND DIMENSION IN AN ARRAY SALES? sales[5][12]
A12
B5
C60
D11
Correct Answer: Option A
Note: null
MCQ 221Calender class
Which constant of Calendar class set day number in the year (1 for the first day)?
ADAY.OF.YEAR
BDAY_OF_YEAR
Cday-of-year
Ddayofyear
Correct Answer: Option B
Note: G-March-2022
MCQ 222Introduction of Array
In Java, which of the following methods calls sort elements of array โlistโ from list [1] to list [5-1] ?
Asort (list)
Bjava.sort (list)
Cjava.util.Arrays.sort (list, 1, 5)
Djava.util.sort (list, 5)
Correct Answer: Option C
Note: G-March-2022
MCQ 223Introduction of Array
In Java, which of the following is a proper example of initializing 1-D array? (i) int marks [3]= {90,100,110}; (i) int marks[] = {90,100,110}; (iii) int[] marks = {90,100,110};
Aonly (i)
B(i) and (ii)
C(i) and (iii)
D(ii) and (iii)
Correct Answer: Option D
Note: G-March-2022
MCQ 224Introduction of Array
Which of the following constructors can create a string object with its initial value using โaryโ argument?
Astring ( )
Bstring (string strobj)
Cstring (string literal)
Dstring (char ary[ ])
Correct Answer: Option D
Note: G-May-2019
MCQ 225Introduction of Array
In 1-D array of Java, which property is used to know size of each row?
Asize
Bfloat
Clength
Dwidth
Correct Answer: Option C
Note: G-May-2019
MCQ 226Introduction of Array
Which of the following is the correct syntax to declare Array in Java?
A< array name>[ ]< data type>;
B< array name> < data type> [ ];
C< array name> < class name>[];
D< data type> < array name> [ ] ;
Correct Answer: Option D
Note: G-May-2019,S-March-2020
MCQ 227Introduction of Array
Which sign is used to enclose the string in Java?
Aโ โ
B" โ
C# #
D$ $
Correct Answer: Option B
Note: null
MCQ 228Introduction of Array
Which type of data can be presented using an array in Java?
AVector
BMatrix
CMulti-dimensional
DAll of the given
Correct Answer: Option D
Note: null
MCQ 229Introduction of Array
With which number an index value start in an array?
A1
B-1
C0
DNone of the given
Correct Answer: Option C
Note: null
MCQ 230Strings class methods
In string class,which of the following method is used to return a string after appending str with the invoking string ?
AString Add(String str)
BString Concat(String str)
CString toLowerCase( )
DString Append(String str)
Correct Answer: Option B
Note: GSEB Commerce Oct-2020
MCQ 231Strings class methods
Which operator is used, when string objects have Separate allocated memory and are identical?
Aliteral
Bnew
Ccreate
D(A)and(B)both
Correct Answer: Option B
Note: GSEB Commerce Oct-2020
MCQ 232Date Class
In date class, which method is used to construct date object using specify time in milliseconds elapsed since January 1, 1970 GMT?
ADate()
BLong getTime()
CDate ( long elapsedTime )รย
DString toString()
Correct Answer: Option B
Note: GSEB Commerce Oct-2020
MCQ 233Introduction of Array
In Java, which constant of calender class will display day number in the year?
ADAY OF YEAR
BDAY
CDAY_OF_MONTH
DDAY OF WEEK
Correct Answer: Option A
Note: G-March-2022
MCQ 234Introduction of Array
In Java, how many integer values can be stored using following array? int marks [] [] = new int [4] [4]; .
A4
B8
C16
D64
Correct Answer: Option C
Note: G-March-2022
MCQ 235Introduction of Array
Which of the following methods of string class of Java returns true if invoking string is same as str after ignoring case?
Aboolean equals ignore case (string str)
Bint compare To (string str)
Cboolean equals (string str)
Dint length()
Correct Answer: Option A
Note: G-March-2022
MCQ 236Introduction of Array
Which kind of variables are of basic data types and can store only one value at a time?
AArray variables
B1-D variables
C2-D variables
DScalar variables
Correct Answer: Option D
Note: G-March-2022
MCQ 237Introduction of Array
In Java which method of date class returns number of milliseconds since January1, 1970 GMT?
ADate (long elapsedTime)
Blong getTime ( )
CDate ( )
Dvoid setTime (long elapsedTime)
Correct Answer: Option B
Note: G-March-2022
MCQ 238Introduction of Array
Which of the following is a one-dimensional data structure that can be used to store list of items like characters, numbers?
Avector
Bmatrix
Crow
Dcolumn
Correct Answer: Option A
Note: G-May-2019
MCQ 239Introduction of Array
Which of the following methods does element by element comparison in a serial fashion?
ABinary Search ( )
BLinear Search
CRandom Search
DNumerical Search
Correct Answer: Option B
Note: G-May-2019
MCQ 240Introduction of Array
In Java, which of the following are useful when same operations are to be performed on various elements of the similar type?
AArrays
BVariables
CCharacters
DString
Correct Answer: Option A
Note: G-May-2019
MCQ 241Introduction of Array
How many arguments are required to fill partial array in Java?
A3
B4
C2
D1
Correct Answer: Option B
Note: G-May-2019
MCQ 242Introduction of Array
In Java, which of the following classes contains methods like sort ( ) and fill ( )?
Ajava.lang
BArrays.java
Cjava.util.Arrays
Dutil.Arrays
Correct Answer: Option C
Note: G-May-2019
MCQ 243Introduction of Array
What will be the value of the element J [2] in the following array in Java? int J [ ] = {70, 31, 10, 45, 50};
A31
B2
C10
DJ [2]
Correct Answer: Option C
Note: G-May-2019
MCQ 244Introduction of Array
In java, which of the following is an object used to mange list of items?
AArray
BForm
CWindow
DDocument
Correct Answer: Option A
Note: GSEB Commerce Oct-2020
MCQ 245Strings
WHICH STRING CONSTRUCTOR IS USED WITHOUT ARGUMENT TO CREATE A STRING OBJECT WITH NO CHARACTERS.
ASTRING()
BSTRING (CHAR ARY [])
CSTRING (SSO)
DSTRING (STR LITERAL)
Correct Answer: Option A
Note: null
MCQ 2461-D Array
IN JAVA, TO SEARCH AN ELEMENT IN AN ARRAY, ARRAY CLASS PROVIDES WHICH TYPE OF METHOD.
AFILL()
BBINARYSEARCH()
CSORT()
DREMOVE()
Correct Answer: Option B
Note: null
MCQ 2471-D Array
WHICH TYPE OF BRACE IS USED TO INITIALIZE DATA ELEMENT IN 1-D ARRAY.
A<>
B[]
C{}
D()
Correct Answer: Option C
Note: null
MCQ 248Strings class methods
IN JAVA,IF STR IS THE OBJECT OF STRING CLASS AND ITS CONTENT IS "HELLO" THEN WHAT IS THE VALUE OF STR.LENGTH().
A8
B7
C6
D5
Correct Answer: Option D
Note: null
MCQ 2492-D Array
WE CAN USE VARIOUS STATIC METHODS PROVIDED BY JAVA USING WHICH ARRAY CLASS.
AJAVA.UTIL.ARRAYS
BJAVA.JO
CJAVA.LANG
DALL OF THESE
Correct Answer: Option A
Note: null
MCQ 250Date Class
WHICH METHOD OF DATE CLASS CONSTRUCTS DATE OBJECT USING CURRENT SYSTEM TIME IN JAVA?
ADATE & TIME()
BTODAYS DATE()
CDATE()
DNOW()
Correct Answer: Option C
Note: null
MCQ 251Introduction of Array
ARRAYS ARE USEFUL TO REPRESENT WHICH TYPE OF DATA IN JAVA?
AVECTOR
BMATRIX
CMULTI
DALL OF THESE
Correct Answer: Option D
Note: null
MCQ 252Introduction of Array
An array object can be created in how many ways?
AUsing new operator and specifying the size
BDirectly initializing the content of array
CSpecify the size
DBoth a and b
Correct Answer: Option D
Note: null
MCQ 253Introduction of Array
Declaring an array without โฆโฆโฆโฆโฆ..does not create an array object.
Ainitialization
BDeclaration
CInstantiation
DNone of these
Correct Answer: Option A
Note: null
MCQ 254Introduction of Array
In Java, int compareto(String str) method returns which value if invoking string is equal to str?
A0 zero
B> 0
C<0
D-1
Correct Answer: Option A
Note: null
MCQ 255Introduction of Array
In Java, which constant of calender class will display day number in the year?
ADAY OF YEAR
BDAY
CDAY_OF_MONTH
DDAY OF WEEK
Correct Answer: Option A
Note: G-March-2022
MCQ 256Introduction of Array
In Java, which of the following classes contains methods like sort ( ) and fill ( )?
Ajava.lang
BArrays.java
Cjava.util.Arrays
Dutil.Arrays
Correct Answer: Option C
Note: G-May-2019
MCQ 257Introduction of Array
In Java 2-D array, each row is considered as ___________________
A1D array element
Bdimension
Ccolumn
DNone of the given
Correct Answer: Option A
Note: null
MCQ 258Introduction of Array
Arrays are useful to represent_____________ data.
Avector
Bmatrix
Cmulti-dimensional
DAll of the given
Correct Answer: Option D
Note: null
MCQ 259Introduction of Array
In Java, which property of 1-D array is used to know size of each row?
Asize
Blength
Csort
Dfill
Correct Answer: Option B
Note: G-March-2022
MCQ 260Introduction of Array
In 1-D array of Java, which of the following symbols is used to separate elements in a pair of { } braces?
AComma
BPlus
CUnderscore
DSpace
Correct Answer: Option A
Note: G-May-2019
MCQ 261Introduction of Array
How many arguments are required to fill partial array in Java?
A3
B4
C2
D1
Correct Answer: Option B
Note: G-May-2019
MCQ 262Strings class methods
Which operator is used, when string objects have Separate allocated memory and are identical?