Question: 1-When the following expression is evaluated, the result will be what Java data type? 5 / 3 char none of these double float String int

1-When the following expression is evaluated, the result will be what Java data type? 5 / 3

char

none of these

double

float

String

int

boolean

2-Given the following declaration: String s = "0123456789"; Evaluate the expression: s.charAt(2)

'01'

none of these

'3'

'1'

'012'

'2'

3- Given the following declaration: String s = "Apples and bananas are yummy."; Evaluate the expression: s.indexOf("a")

12

7

none of these

9

10

11

8

0

-1

4- What is the output of this Java program?

class Driver { public static void main(String[] args) { int a = 5; int b = 3; if (a > b || a * 2 > b){ System.out.print(a);} System.out.print(b); } }

3

53

none of these

35

5

5-

Which of the following Java expressions represents a legal way of checking whether a value assigned to the num variable falls in the range from -10 through -20?

if (num >= -20 && num <= -10)

if (num <= -20 || num >= -10)

if (num >= -20 || num <= -10)

if (num <= -20 && num >= -10)

6- Which of the following correctly declares a variable of type char in Java? Choose all that apply.

char a;

none of these

char[] a = new char[3];

char a = '0';

a = char(3);

char[] a = '0';

char a = new char();

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!