Questions · Page 1 of 7

MCQ

🎯

Test yourself on this topic

50 questions · timed · auto-graded

MCQ 11 Mark
Which value is returned if the value of an element given in binary Search () method is not found in an array?
  • -1
  • B
    0
  • C
    1
  • D
    Index Position
Answer
Correct option: A.
-1
-1
View full question & answer
MCQ 21 Mark
Which value is returned if the value of an element given in binary Search () method is found in an array?
  • A
    —1
  • B
    0
  • C
    1
  • Index Position
Answer
Correct option: D.
Index Position
Index Position
View full question & answer
MCQ 31 Mark
Is array name a reference variable referring to memory location where its elements are stored?
  • Yes
  • B
    No
  • C
    Depend on the type of an array
  • D
    Depend on the length of an array
Answer
Correct option: A.
Yes
Yes
View full question & answer
MCQ 41 Mark
Array is treated as an object of the following class.
  • Arrays
  • B
    D
  • C
    1-D
  • D
    Java Arrays
Answer
Correct option: A.
Arrays
Arrays
View full question & answer
MCQ 51 Mark
By using which of the following array of arrays can we practically get multi- dimensional arrays?
  • 1-D
  • B
    2-D
  • C
    3-D
  • D
    All of these
Answer
Correct option: A.
1-D
1-D
View full question & answer
MCQ 61 Mark
Which type of array does Java support basically?
  • 1-D
  • B
    2-D
  • C
    3-D
  • D
    All of these
Answer
Correct option: A.
1-D
1-D
View full question & answer
MCQ 71 Mark
What is used to have collection of variables of same data type?
  • A
    String
  • Array
  • C
    Literal
  • D
    Package
Answer
Correct option: B.
Array
Array
View full question & answer
MCQ 81 Mark
Which of the statement is intended to check whether the time of Calendar object of Calendar class is of morning or not?
  • if (Calendar. Get(Calendar1.AM_PM) = =0)
  • B
    if (Calendar. Get(Calendar1.AM_PM) = = 1)
  • C
    if (Calendar. Get(Calendar1.AM_PM) = 0)
  • D
    if (Calendar. Get(Calendar1.AM_PM) = 1)
Answer
Correct option: A.
if (Calendar. Get(Calendar1.AM_PM) = =0)
if (Calendar. Get(Calendar1.AM_PM) = =0)
View full question & answer
MCQ 91 Mark
What will be set by execution of call “Calendar.Set (Calendar.Date,20)” if Calendar is an object of Calendar Class?
  • Date 20
  • B
    20th day of year
  • C
    Second 20
  • D
    None of these
Answer
Correct option: A.
Date 20
Date 20
View full question & answer
MCQ 101 Mark
By using which of the following method we can set the values of field constant for Calendar class?
  • A
    display ()
  • B
    show ()
  • set ()
  • D
    craw0
Answer
Correct option: C.
set ()
set ()
View full question & answer
MCQ 111 Mark
Which of the following is a subclass of Calendar class?
  • Gregorian Calendar
  • B
    Calendar
  • C
    Calendar
  • D
    None of these
Answer
Correct option: A.
Gregorian Calendar
Gregorian Calendar
View full question & answer
MCQ 121 Mark
Which kind of names are given to the constants defined in Calendar class?
  • A
    Meaningful
  • B
    Self-explanatory
  • a and b both
  • D
    None of these
Answer
Correct option: C.
a and b both
a and b both
View full question & answer
MCQ 131 Mark
Which information can be extracted by Calendar class of java.util package of Java?
  • A
    Year, Month, Date
  • B
    Hour, Minute, Second
  • a and b both
  • D
    User’s name
Answer
Correct option: C.
a and b both
a and b both
View full question & answer
MCQ 141 Mark
Which of the following classes is provided in java.util package?
  • A
    Date
  • B
    Time
  • C
    Calendar
  • a and b both
Answer
Correct option: D.
a and b both
a and b both
View full question & answer
MCQ 151 Mark
Date () method is stored in datel1 variable. Which statement is used to present current date and time as string?
  • date1.toString()
  • B
    date1.Tostring()
  • C
    date1.date()
  • D
    date1.getTime()
Answer
Correct option: A.
date1.toString()
date1.toString()
View full question & answer
MCQ 161 Mark
Does the Date class of Java represent the value up to precision?
  • A
    Second
  • B
    Micro seconds
  • C
    Minute
  • Mili seconds
Answer
Correct option: D.
Mili seconds
Mili seconds
View full question & answer
MCQ 171 Mark
Which of the following Java class encapsulate both date and time?
  • Date
  • B
    Time
  • C
    Date time
  • D
    new Date
Answer
Correct option: A.
Date
Date
View full question & answer
MCQ 181 Mark
Which package of Java library provides Date class?
  • java.util
  • B
    java.lang
  • C
    java.Array
  • D
    java.date
Answer
Correct option: A.
java.util
java.util
View full question & answer
MCQ 191 Mark
Which of the following statements is used to know the number of characters of variable Str?
  • Strength ()
  • B
    Strength {}
  • C
    Str.len()
  • D
    Str.getLength()
Answer
Correct option: A.
Strength ()
Strength ()
View full question & answer
MCQ 201 Mark
Which of the following method of String class is used to convert a string into an array of bytes?
  • get Bytes ()
  • B
    Bytes ()
  • C
    get bytes ()
  • D
    Convert bytes ()
Answer
Correct option: A.
get Bytes ()
get Bytes ()
View full question & answer
MCQ 211 Mark
By using which methods of String class can we determine the length of string?
  • length ()
  • B
    Len()
  • C
    Charlene ()
  • D
    Length ()
Answer
Correct option: A.
length ()
length ()
View full question & answer
MCQ 221 Mark
By using which methods of String class one can know the number of characters of a string?
  • length ()
  • B
    Len()
  • C
    Charlene ()
  • D
    Length ()
Answer
Correct option: A.
length ()
length ()
View full question & answer
MCQ 231 Mark
To perform which of the following operation String class of Java does not provide any method?
  • A
    To compare two strings
  • B
    To concatenate two strings
  • To reverse string
  • D
    To split a string
Answer
Correct option: C.
To reverse string
To reverse string
View full question & answer
MCQ 241 Mark
While using which of the following we need to use ()?
  • String object
  • B
    Array
  • C
    Byte
  • D
    Character
Answer
Correct option: A.
String object
String object
View full question & answer
MCQ 251 Mark
What is length for String object?
  • Method
  • B
    Class
  • C
    Value
  • D
    Attribute or Property
Answer
Correct option: A.
Method
Method
View full question & answer
MCQ 261 Mark
What is length for array variable?
  • A
    Method
  • B
    Class
  • C
    Value
  • Attribute or Property
Answer
Correct option: D.
Attribute or Property
Attribute or Property
View full question & answer
MCQ 271 Mark
Which of the following statement is true to return a string with all characters of Str1 converted to uppercase?
  • A
    Str1.uppercase()
  • B
    Str1.touppercase()
  • C
    Str1.tocapitalcase()
  • Str1.toUppercase()
Answer
Correct option: D.
Str1.toUppercase()
Str1.toUppercase()
View full question & answer
MCQ 281 Mark
Which of the following statements is true to return a string with all characters of Str1 converted to lowercase?
  • A
    Str1.LowerCase()
  • Str1.toLowerCase()
  • C
    Str1.ChangeCase()
  • D
    Str1.tolowerCase()
Answer
Correct option: B.
Str1.toLowerCase()
Str1.toLowerCase()
View full question & answer
MCQ 291 Mark
Which of the following methods is for String class?
  • A
    Converting string into an array of bytes
  • B
    Converting string into lower case or upper case
  • C
    Appending string, copy string or part of string
  • All of these
Answer
Correct option: D.
All of these
All of these
View full question & answer
MCQ 301 Mark
Which of the following methods is for String class?
  • A
    Converting strings, Extracting part of strings
  • B
    Searching for characters or patterns in string
  • C
    Getting character at specified index position
  • All of these
Answer
Correct option: D.
All of these
All of these
View full question & answer
MCQ 311 Mark
Which of the following methods is for String class?
  • A
    To compare strings, combining strings
  • B
    To find length of the strings, splitting substrings
  • C
    Obtaining substrings
  • All of these
Answer
Correct option: D.
All of these
All of these
View full question & answer
MCQ 321 Mark
Which memory location do both the objects refer if they are created using “new” operator in a program?
  • Different
  • B
    Same
  • C
    Two
  • D
    Three
Answer
Correct option: A.
Different
Different
View full question & answer
MCQ 331 Mark
For which object, separate memory is not allocated if string objects Strl and Str2 are created using same literals but without “new” operator?
  • Str2
  • B
    Str1
  • C
    a and b both
  • D
    None of these
Answer
Correct option: A.
Str2
Str2
View full question & answer
MCQ 341 Mark
If Str1 and Str2 are created without using “new” operator then which variable refers to the same instance as created for Str1?
  • A
    Variable Stri1
  • B
    Variable Stri2
  • a and b both
  • D
    None of these
Answer
Correct option: C.
a and b both
a and b both
View full question & answer
MCQ 351 Mark
What is specified by the statement Str1 = = Str2 if Str1 and Str2 are created using “new” operator?
  • It compares the objects of two reference variables.
  • B
    It compares the content of two reference variables.
  • C
    a and b both
  • D
    None of these
Answer
Correct option: A.
It compares the objects of two reference variables.
It compares the objects of two reference variables.
View full question & answer
MCQ 361 Mark
What is specified if string objects Str1 and Str2 are created using same string literal but without using “new” operator?
  • It compares the content of two reference variables.
  • B
    It compares the objects of two reference variables.
  • C
    a and b both
  • D
    None of these
Answer
Correct option: A.
It compares the content of two reference variables.
It compares the content of two reference variables.
View full question & answer
MCQ 371 Mark
Which of the following statements is true to compare the contents of Str1 and Str2?
  • Str1 = = Str2
  • B
    Str1 = Str2
  • C
    Str. Str2
  • D
    Str1; Str2
Answer
Correct option: A.
Str1 = = Str2
Str1 = = Str2
View full question & answer
MCQ 381 Mark
Using which operator if string objects are created than separate memory is allocated even if strings are identical?
  • new
  • B
    byte
  • C
    char
  • D
    string
Answer
Correct option: A.
new
new
View full question & answer
MCQ 391 Mark
Which statement is true in reference of memory for second object when two string objects are created using same string literals?
  • Both objects refer to different memory location.
  • B
    Both objects refer to same memory location.
  • C
    a and b both
  • D
    None of these
Answer
Correct option: A.
Both objects refer to different memory location.
Both objects refer to different memory location.
View full question & answer
MCQ 401 Mark
Where are literals stored?
  • A
    In the Pen drive
  • B
    In the CD
  • In the Memory
  • D
    In the Hard disk
Answer
Correct option: C.
In the Memory
In the Memory
View full question & answer
MCQ 411 Mark
When should we use an array of bytes instead of array of characters when following characters are present?
  • A
    Unicode
  • B
    Ansi
  • ASCII
  • D
    EBCDIC
Answer
Correct option: C.
ASCII
ASCII
View full question & answer
MCQ 421 Mark
What should we use instead of array of characters if the characters are ASCII?
  • byte
  • B
    short
  • C
    string
  • D
    int
Answer
Correct option: A.
byte
byte
View full question & answer
MCQ 441 Mark
Which operator is used in Java to create an object?
  • new
  • B
    add
  • C
    create
  • D
    make
Answer
Correct option: A.
new
new
View full question & answer
MCQ 451 Mark
Which class does Java support to use variables that can store strings?
  • A
    String
  • B
    String Buffer
  • Both a and b
  • D
    None of these
Answer
Correct option: C.
Both a and b
Both a and b
View full question & answer
MCQ 461 Mark
In which of the following symbols a sequence of characters is enclosed?
  • “ “
  • B
    ``
  • C
    ‘‘
  • D
    \* *\
Answer
Correct option: A.
“ “
“ “
View full question & answer
MCQ 471 Mark
What can be considered as 1-D array of characters?
  • String
  • B
    Character
  • C
    Array
  • D
    Literal
Answer
Correct option: A.
String
String
View full question & answer
MCQ 481 Mark
Which of the following is a sequence of characters?
  • String
  • B
    Array
  • C
    Character
  • D
    Literal
Answer
Correct option: A.
String
String
View full question & answer
MCQ 491 Mark
What is not created by declaring an array without initialization?
  • An array object
  • B
    Method
  • C
    Class
  • D
    Variable
Answer
Correct option: A.
An array object
An array object
View full question & answer
MCQ 501 Mark
What can be the size of 2nd, 3rd…. Dimensions of multi-dimensional arrays?
  • A
    Same
  • B
    With 5 elements
  • Different(variable)
  • D
    With 3 elements
Answer
Correct option: C.
Different(variable)
Different(variable)
View full question & answer
MCQ - Computer STD 12 Commerce Questions - Vidyadip