Java Programming (3350703) MCQs

MCQs of Building Blocks of the Language

Showing 21 to 30 out of 51 Questions
21.

Which of the following method of StringBuffer class is used to concatenate the string to the end of invoking string?

(StringBuffer ક્લાસ ની કઈ મેથડ આપેલ સ્ટ્રીંગ ને અંતે બીજી સ્ટ્રીંગ કોન્કેટ કરવા માટે ઉપયોગી છે?)

(a)

concat()

(b)

concatenate()

(c)

append()

(d)

appended()

Answer:

Option (c)

22.

What will be the output of following code?

(નીચે આપેલ કોડ નું આઉટપુટ શું આવશે?)

(a)

HelloWelcome

(b)

Hello

(c)

Hello Welcome

(d)

null

Answer:

Option (b)

23.

What will be the output of following code?

(નીચે આપેલ કોડ નું આઉટપુટ શું આવશે?)

(a)

16

(b)

21

(c)

22

(d)

23

Answer:

Option (d)

24.

What will be the output of following code?

(નીચે આપેલ કોડ નું આઉટપુટ શું આવશે?)

(a)

1

(b)

-1

(c)

0

(d)

2

Answer:

Option (c)

25.

insert() method available in which of following class?

(નીચે આપેલ ક્યા ક્લાસ મા insert() મેથડ આવેલ છે?)

(a)

StringBuffer (સ્ટ્રીંગબફર)

(b)

String (સ્ટ્રીંગ)

(c)

Array (એરે)

(d)

List (લીસ્ટ)

Answer:

Option (a)

26.

Which of following is Bitwise unary NOT operator in java?

(નીચે આપેલમાંથી કયો ઓપરેટર Javaમા Bitwise યુનરી NOT ઓપરેટર છે?)

(a)

!

(b)

˜

(c)

<

(d)

>>

Answer:

Option (b)

27.

What will be the output of following code?

(નીચે આપેલ કોડ નું આઉટપુટ શું આવશે?)

(a)

2

(b)

9

(c)

1

(d)

false

Answer:

Option (a)

28.

What will be the output of following code?

(નીચે આપેલ કોડ નું આઉટપુટ શું આવશે?)

(a)

7.0  7.0  7

(b)

7.0  6.0  7

(c)

6.0  7.0  7

(d)

6.0  6.0  6

Answer:

Option (c)

29.

What will be the output of following code?

class demo{
   public static void main(String ar[])
   {
      for (int i=0; i < 1; System.out.println("Hello")) 
         System.out.println("Welcome");  
   }
}

નીચે આપેલ કોડ નું આઉટપુટ શું આવશે?

class demo{
   public static void main(String ar[])
   {
      for (int i=0; i < 1; System.out.println("Hello")) 
         System.out.println("Welcome");  
   }
}
(a)

Welcome

Hello

(b)

Welcome

Hello

Welcome

Hello

(c)

Welcome

Hello 

(Above both statement sequence infinitely)

Welcome

Hello

(ઉપરના બંને સ્ટેટમેન્ટ ની સીકવન્સ ઇન્ફાઈનાઇટ વખત પ્રિન્ટ થશે)

(d)

compilation error

કમ્પાઈલેશન એરર

Answer:

Option (c)

30.

What will be the output of following code?

(નીચે આપેલ કોડ નું આઉટપુટ શું આવશે?)

(a)

5

(b)

6

(c)

7

(d)

8

Answer:

Option (d)

Showing 21 to 30 out of 51 Questions