Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 (1 point) You are designing a program for users to enter whole numbers that range from -200 to 2147483648. What Java data type

Question 1 (1 point)

You are designing a program for users to enter whole numbers that range from -200 to 2147483648. What Java data type will best satisfy this range of numbers?

Question 1 options:

int

long

byte

short

char

Question 2 (1 point)

You are designing a program for users to enter whole numbers that range from -100 to 127. What Java data type will best and most efficiently satisfy this range of numbers?

Question 2 options:

long

byte

int

char

short

Question 3 (1 point)

What is the filename extension used for all Java source files.

Question 3 options:

.js

.java

.javac

.cs

None of the above

Question 4 (1 point)

The following java code was created to print Hello, World!

public class JavaQuiz

{

public static void main (String[] args)

{

System.out.println ("Hello, World!");

}

}

What is the name of the Java source file?

Question 4 options:

Insufficient information to determine

HelloWorld.java

Main.java

Quiz.java

JavaQuiz.java

Question 5 (1 point)

What must be installed on a computer to be able to run bytecodes?

Question 5 options:

Java Virtual Machine (VM)

Microsoft Visual Basic

Ubuntu Server

Oracle Database (11g or higher)

None of the above

Question 6 (1 point)

Which of the following statements is a comment in Java

Question 6 options:

/ This is a test

public class Hello {

// This is a test. //

(String[] args)

None of the above

Question 7 (1 point)

What Java keyword can used to create a named constant?

Question 7 options:

static

public

final

enum

default

Question 8 (1 point)

Select the invalid declaration from the lines of Java code below

Question 8 options:

int zebraCnt = 40000;

long birdCnt = 222_222_222_222_222L;

float avg = 23.5;

double avg = 98.32121;

None of the above. All are legal declaration.

Question 9 (1 point)

What is the filename extension used for all Java compiled files.

Question 9 options:

.cs

.javac

.bytes

.class

None of the above

Question 10 (1 point)

In Java, if var1 = Hello and var2 = UMUC, what would this line of code produce as output?

System.out.println(var1 + var2);

Question 10 options:

No output

Hello UMUC

HelloUMUC

None of the above

Question 11 (1 point)

Given the following sequence of Java code:

int var1 = 9;

int var2 = 12;

int var3 = 12;

Which of the following statements evaluate to true

Question 11 options:

var1 != var2

var1 < var2

var1 <= var2

var2 == var3

All of the above

Question 12 (1 point)

Given the following sequence of Java code:

int var1 = 9;

int var2 = 12;

int var3 = 12;

Which of the following statements evaluate to true

Question 12 options:

(var1 == var2) || (var1 < var2)

(var1 == var2) && (var1 < var2)

!(var2 == var3)

(var2 <= var3) && (var2 < var1)

None of the above

Question 13 (1 point)

A non-local boolean variable is declared with the following Java code:

boolean myVar;

What is the value of myVar?

Question 13 options:

true

false

null

Unknown

None of the above

Question 14 (1 point)

From the list of Java variable names below, select the illegal variable name.

Question 14 options:

K149a$

Johns1290sX4k

XXXXXXXXXXXXXXYYYYYYYYYYYYYYYzzzzzzzzzzzzzzzz

NoneForYou

2ForMe

Question 15 (1 point)

Will the following Java code compile and run without errors?

public class QuizItem

{

public static void main(String[] args)

{

final int age = 38;

age = 39;

System.out.println("Age is " + age);

}

}

Question 15 options:

No

Yes

Question 16 (1 point)

Select the Java code that will correctly declare a boolean variable named success and assign it a value of false.

Question 16 options:

None of the above

boolean success = 1;

Boolean success = true;

boolean success = 0;

int success = false;

Question 17 (1 point)

What are bytecodes?

Question 17 options:

The Java VM

8 bits are used for each bytecode

The launcher tool for Java programs

The Java Compiler (javac)

None of the above

Question 18 (1 point)

What development tool do you use to launch Java bytecodes?

Question 18 options:

java

javadoc

javac

jconsole

All of the above

Question 19 (1 point)

Given the following sequence of Java code:

int var1 = 0b0001;

int var2 = 0b1111;

int results1 = var1 & var2;

int results2 = var1 | var2;

int results3 = var1 ^ var2;

int printit = results1 + results2 + results3;

What are the values for results1, results2, results3 and printit after executing the code?

Question 19 options:

results1=15; results2=1; results3=14; printit = 15114

results1=1; results2=14; results3=15; printit = 29

results1=1; results2=15; results3=14; printit = 11514

results1=1; results2=15; results3=14; printit = 30

None of the above

Question 20 (1 point)

Which of the following is an invalid Java statement:

Question 20 options:

System.out.println("Hello, World! ");

int d = 14;

d++;

x + y/100;

None of the above

Question 21 (1 point)

If we declared the following variables in Java

int age = 27;

int cafe = 0xCAFE;

int number1 =0b0001;

What is the output for the following Java statement?

System.out.println(age + cafe + number1);

Question 21 options:

2720001

51994

54,false,A5194327

None of the above

Question 22 (1 point)

From the list of Java variable names below, select the illegal variable name.

Question 22 options:

Why_2390

NotAllowed

Jklm1_

finally

X

Question 23 (1 point)

Given the following sequence of Java code:

int var1 = 9;

int var2 = 12;

boolean failure = false;

int result = failure ? var1 : var2;

What is the value of result after executing the code?

Question 23 options:

9:12

12

9

0.75

3

Question 24 (1 point)

What is the maximum value that can be assigned to a long variable in Java?

Question 24 options:

200000

9223372036854775807

4GB

231 -1

Question 25 (1 point)

What is the output from the following Java code?

public class Week1Quiz {

public static void main (String[] args) {

System.out.println ("Welcome");

System.out.println ("to");

System.out.print ("UMUC!");

}

}

Question 25 options:

WelcometoUMUC

Welcome to UMUC!

No output as the code will not compile.

None of the above

Welcome to UMUC

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2016 Riva Del Garda Italy September 19 23 2016 Proceedings Part 1 Lnai 9851

Authors: Paolo Frasconi ,Niels Landwehr ,Giuseppe Manco ,Jilles Vreeken

1st Edition

3319461273, 978-3319461274

More Books

Students also viewed these Databases questions

Question

Describe simulation questions on the CPA exam?

Answered: 1 week ago