Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions