Deck 14: Java Programming:methods, Data Types, Operators, and Classes
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/25
Play
Full screen (f)
Deck 14: Java Programming:methods, Data Types, Operators, and Classes
1
What is the string contained in s after following lines of code?
StringBuffersnewStringBuffer("Hello");S)deleteCharAt(0);
A)Hell
B)ello
C)Hel.
D)llo.
StringBuffersnewStringBuffer("Hello");S)deleteCharAt(0);
A)Hell
B)ello
C)Hel.
D)llo.
ello
2
Which of these method(s) is/are used for writing bytes to an outputstream?
A)put()
B)print() and write()
C)printf()
D)write() and read()
A)put()
B)print() and write()
C)printf()
D)write() and read()
print() and write()
3
Which keyword is used by the method to refer to the object that invoked it?
A)import
B)catch
C)abstract
D)this
A)import
B)catch
C)abstract
D)this
this
4
What is the return type of a method that does not return any value?
A)int
B)float
C)void
D)double
A)int
B)float
C)void
D)double
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
5
Which of these selection statements test only for equality?
A)if
B)switch
C)if & switch
D)none of the mentioned
A)if
B)switch
C)if & switch
D)none of the mentioned
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
6
Which of these jump statements can skip processing the remainder of the code in its body for a particular iteration?
A)break
B)return
C)exit
D)continue
A)break
B)return
C)exit
D)continue
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
7
Which of these is the method which is executed first before execution of any other thing takes place in a program?
A)main method
B)finalize method
C)static method
D)private method
A)main method
B)finalize method
C)static method
D)private method
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
8
Which of these data type can be used for a method having a return statement in it?
A)void
B)int
C)float
D)both int and float
A)void
B)int
C)float
D)both int and float
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
9
If an expression contains double, int, float, long, then the whole expression will be promoted into which of these data types?
A)long
B)int
C)double
D)float
A)long
B)int
C)double
D)float
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
10
Which of the below is invalid identifier with the main method?
A)public
B)static
C)private
D)final
A)public
B)static
C)private
D)final
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
11
Which of these can not be used for a variable name in Java?
A)identifier
B)keyword
C)identifier & keyword
D)none of the mentioned
A)identifier
B)keyword
C)identifier & keyword
D)none of the mentioned
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
12
which of the following can be operands of arithmetic operators?
A)Numeric
B)Boolean
C)Characters
D)Both Numeric & Characters
A)Numeric
B)Boolean
C)Characters
D)Both Numeric & Characters
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
13
How to copy contents of array?
A)System.arrayCopy()
B)Array.copy()
C)Arrays.copy()
D)Collection.copy()
A)System.arrayCopy()
B)Array.copy()
C)Arrays.copy()
D)Collection.copy()
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
14
Which of these are selection statements in Java?
A)if()
B)for()
C)continue
D)break
A)if()
B)for()
C)continue
D)break
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
15
Which of these operators is used to allocate memory for an object?
A)malloc
B)alloc
C)new
D)give
A)malloc
B)alloc
C)new
D)give
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
16
Which of these packages contains the exception Stack Overflow in Java?
A)java.lang
B)java.util
C)java.io
D)java.system
A)java.lang
B)java.util
C)java.io
D)java.system
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
17
Which of this method of class String is used to obtain a length of String object?
A)get()
B)Sizeof()
C)lengthof()
D)length()
A)get()
B)Sizeof()
C)lengthof()
D)length()
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
18
Which of these methods of a Thread class is used to suspend a thread for a period of time?
A)sleep()
B)terminate()
C)suspend()
D)stop()
A)sleep()
B)terminate()
C)suspend()
D)stop()
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
19
Which of these exceptions will be thrown if we use null reference for an arithmetic operation?
A)ArithmeticException
B)NullPointerException
C)IllegalAccessException
D)IllegalOperationException
A)ArithmeticException
B)NullPointerException
C)IllegalAccessException
D)IllegalOperationException
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
20
Which of the interface contains all the methods used for handling thread related operations in Java?
A)Runnable interface
B)Math interface
C)System interface
D)ThreadHandling interface
A)Runnable interface
B)Math interface
C)System interface
D)ThreadHandling interface
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
21
Which of these class is used to read and write bytes in a file?
A)FileReader
B)FileWriter
C)FileInputStream
D)InputStreamReader
A)FileReader
B)FileWriter
C)FileInputStream
D)InputStreamReader
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
22
Which of these classes is used for input and output operation when working with bytes?
A)InputStream
B)Reader
C)Writer
D)All of the mentioned
A)InputStream
B)Reader
C)Writer
D)All of the mentioned
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
23
Which of these class is a superclass of all other classes?
A)Math
B)Process
C)System
D)Object
A)Math
B)Process
C)System
D)Object
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
24
Which of these class is not a member class of java.io package?
A)String
B)StringReader
C)Writer
D)File
A)String
B)StringReader
C)Writer
D)File
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck
25
Which of these class is not related to input and output stream in terms of functioning?
A)File
B)Writer
C)InputStream
D)Reader
A)File
B)Writer
C)InputStream
D)Reader
Unlock Deck
Unlock for access to all 25 flashcards in this deck.
Unlock Deck
k this deck