SlideShare a Scribd company logo
1 of 13
Download to read offline
All based on Zybooks = AP Java with zylabs
Please answer all questions - no explanation of answers needed
QUESTION 1
char[][] table = new char[10][5];
How many rows are in the array seen in the accompanying figure?
0
5
10
15
QUESTION 2
The standard output object in Java is ____.
output
System.out
Sys.out
System.in
QUESTION 3
The length of the string "first java program" is:
16
18
19
20
1 points
QUESTION 4
The loop condition of a while loop is reevaluated before every iteration of the loop.
True
False
1 points
QUESTION 5
If str1 is “Hello” and str2 is “Hi”, which of the following could not be a result of
str1.compareTo(str2);?
-9
-5
-1
1
1 points
QUESTION 6
Both System.out.println and System.out.print can be used to output a string on the standard
output device.
True
False
1 points
QUESTION 7
In a method call statement, when passing an array as an actual parameter, you use only its name.
True
False
1 points
QUESTION 8
Which of the following is true about a while loop?
The body of the loop is executed at least once.
The logical expression controlling the loop is evaluated before the loop is entered and after the
loop exists.
The body of the loop may not execute at all.
It is a post-test loop
1 points
QUESTION 9
int x, y;
if (x < 4)
y = 2;
else if (x > 4)
{
if (x > 7)
y = 4;
else
y = 6;
}
else
y = 8;
Based on the code above, what is the value of y if x = 9?
2
4
6
8
1 points
QUESTION 10
The array index can be any nonnegative integer less than the array size.
True
False
1 points
QUESTION 11
When a program executes, the first statement to execute is always the first statement in the main
method.
True
False
1 points
QUESTION 12
Java stores two-dimensional arrays in a row order form in computer memory.
True
False
1 points
QUESTION 13
The statement dataType[][][] arrayName; would declare a two-dimensional array.
True
False
1 points
QUESTION 14
All the methods defined in a class must have different names.
True
False
1 points
QUESTION 15
Which of the following is NOT a reserved word in Java?
double
throws
static
num
1 points
QUESTION 16
Given the declaration
int[] list = new int[50];
the statement
System.out.println(list[0] + "..." + list[49]);
outputs all 50 components of the array list.
True
False
1 points
QUESTION 17
In the case of an infinite while loop, the while expression (that is, the loop condition) is always
true.
True
False
1 points
QUESTION 18
Consider the following program.
public class CircleArea
{
static Scanner console = new Scanner(System.in);
static final double PI = 3.14;
public static void main(String[]args)
{
doubler;
double area;
r = console.nextDouble();
area = PI * r * r;
System.out.println("Area = " + area);
}
}
To successfully compile this program, which of the following import statement is required?
import java.io.Scanner;
import java.util.Scanner;
import java.lang.Scanner;
No import statement is required
1 points
QUESTION 19
An identifier can be any sequence of characters and integers.
True
False
1 points
QUESTION 20
A single array can hold elements of many different data types.
True
False
1 points
QUESTION 21
Consider the following program.
// Insertion Point 1
public class CircleArea
{
// Insertion Point 2
static final float PI = 3.14
public static void main(String[]args)
{
//Insertion Point 3
float r = 2.0;
float area;
area = PI * r * r;
System.out.println("Area = " + area);
}
// Insertion Point 4
}
In the above code, where do the import statements belong?
Insertion Point 1
Insertion Point 2
Insertion Point 3
Insertion Point 4
1 points
QUESTION 22
Suppose that x is an int variable. Which of the following expressions always evaluates to false?
(x > 0) || (x <= 0)
(x > 0) || (x == 0)
(x > 0) && ( x <= 0)
(x >= 0) && (x == 0)
1 points
QUESTION 23
What is the value of alpha[4] after the following code executes?
int[] alpha = new int[5];
for (int j = 0; j < 5; j++)
alpha[j] = 2 * j - 1;
one
three
five
seven
1 points
QUESTION 24
If a = 4; and b = 3;, then after the statement a = b; executes, the value of b is 4 and the value of a
is 3.
True
False
1 points
QUESTION 25
The expression !(x <= 0) is true only if x is a positive number.
True
False
1 points
QUESTION 26
In a return method, the last line of the method must be a return statement.
True
False
1 points
QUESTION 27
The expression (int)8.7 evaluates to ____.
8
8.0
9.0
9
1 points
QUESTION 28
A loop is a control structure that causes certain statements to be executed over and over until
certain conditions are met.
True
False
1 points
QUESTION 29
What is stored in alpha after the following code executes?
int[] alpha = new int[5];
for (int j = 0; j < 5; j++)
{
alpha[j] = 2 * j;
if (j % 2 == 1)
alpha[j - 1] = alpha[j] + j;
}
alpha = {0, 2, 4, 6, 8}
alpha = {3, 2, 9, 6, 8}
alpha = {0, 3, 4, 7, 8}
alpha = {0, 2, 9, 6, 8}
1 points
QUESTION 30
Suppose that x and y are int variables and x = 7 and y = 8. After the statement: x = x * y - 2;
executes, the value of x is ____.
42
54
56
58
1 points
QUESTION 31
A counter-controlled loop should be used when the programmer knows the exact number of loop
iterations are needed.
True
False
1 points
QUESTION 32
In Java, a period is used to terminate a statement.
True
False
1 points
QUESTION 33
In Java, return is a reserved word.
True
False
1 points
QUESTION 34
When an array reference is passed to a method, the method can modify the elements of the array
object.
True
False
1 points
QUESTION 35
A local identifier is an identifier that is declared within a method or block and that is visible only
within that method or block.
True
False
1 points
QUESTION 36
An expression such as str.length(); is an example of a(n) ____.
system call
object call
class
method call
1 points
QUESTION 37
Suppose str1 and str2 are String variables. The expression (str1 == str2) determines whether str1
and str2 reference the same String object.
True
False
1 points
QUESTION 38
Just like the nesting of loops, Java allows the nesting of methods.
True
False
1 points
QUESTION 39
Suppose console is a Scanner object initialized with the standard input device. The expression
console.nextInt(); is used to read one int value and the expression console.nextDouble(); is used
to read two int values.
True
False
1 points
QUESTION 40
A compiler translates the assembly language instructions into machine language.
True
False
1 points
QUESTION 41
An identifier can be declared anywhere including within a class, and outside of every method
definition (and every block).
True
False
1 points
QUESTION 42
The following for loop executes 21 times. (Assume all variables are properly declared.)
for (i = 1; i <= 20; i = i + 1)
System.out.println(i);
True
False
1 points
QUESTION 43
Which of the following is the array subscripting operator in Java?
.
{}
new
[]
1 points
QUESTION 44
char[][] table = new char[10][5];
How many columns are in the array seen in the accompanying figure?
0
5
10
15
1 points
QUESTION 45
The digit 0 or 1 is called a ____.
bit
bytecode
Unicode
hexcode
1 points
QUESTION 46
The output of the following Java code is: Stoor.
int count = 5;
System.out.print("Sto");
do
{
System.out.print('o');
count--;
}
while (count >= 5);
System.out.println('r');
True
False
1 points
QUESTION 47
The expression (double)(5 + 4) evaluates to ____.
8
9
9.0
10.0
1 points
QUESTION 48
In Java, !, &&, and || are called logical operators.
True
False
1 points
QUESTION 49
int x, y;
if (x < 4)
y = 2;
else if (x > 4)
{
if (x > 7)
y = 4;
else
y = 6;
}
else
y = 8;
Based on the code above, what is the value of y if x = 4?
2
4
6
8
1 points
QUESTION 50
What is the output of the following code?
int count;
int num = 2;
for (count = 1; count < 2; count++)
{
num = num + 3;
System.out.print(num + " ");
}
System.out.println();
5
5 8
2 5 8
5 8 11
0
5
10
15
Solution
Question 1:
char[][] table = new char[10][5];
How many rows are in the array seen in the accompanying figure?
Answer : 5
Question 2: The standard output object in Java is ____.
Answer : System.out
Question 3: The length of the string "first java program" is:
Answer : 18

More Related Content

Similar to All based on Zybooks = AP Java with zylabsPlease answer all questi.pdf

1 Midterm Preview Time allotted 50 minutes CS 11.docx
1  Midterm Preview Time allotted 50 minutes CS 11.docx1  Midterm Preview Time allotted 50 minutes CS 11.docx
1 Midterm Preview Time allotted 50 minutes CS 11.docxhoney725342
 
Computer java programs
Computer java programsComputer java programs
Computer java programsADITYA BHARTI
 
Test final jav_aaa
Test final jav_aaaTest final jav_aaa
Test final jav_aaaBagusBudi11
 
Introduction to python programming ( part-2 )
Introduction to python programming ( part-2 )Introduction to python programming ( part-2 )
Introduction to python programming ( part-2 )Ziyauddin Shaik
 
CMIS 141 7984 Introductory Programming (2158)A non-local boole.docx
CMIS 141 7984 Introductory Programming (2158)A non-local boole.docxCMIS 141 7984 Introductory Programming (2158)A non-local boole.docx
CMIS 141 7984 Introductory Programming (2158)A non-local boole.docxdrennanmicah
 
05. Java Loops Methods and Classes
05. Java Loops Methods and Classes05. Java Loops Methods and Classes
05. Java Loops Methods and ClassesIntro C# Book
 
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...Udayan Khattry
 
Topic20Arrays_Part2.ppt
Topic20Arrays_Part2.pptTopic20Arrays_Part2.ppt
Topic20Arrays_Part2.pptadityavarte
 
Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]Palak Sanghani
 
Python for Machine Learning
Python for Machine LearningPython for Machine Learning
Python for Machine LearningStudent
 
Page 1 Multiple Choice QuestionsQuestion 1.1. (TCO 1) What.docx
Page 1 Multiple Choice QuestionsQuestion 1.1. (TCO 1) What.docxPage 1 Multiple Choice QuestionsQuestion 1.1. (TCO 1) What.docx
Page 1 Multiple Choice QuestionsQuestion 1.1. (TCO 1) What.docxalfred4lewis58146
 
Please answer the following questions 1 through 30QUESTION 1The .pdf
Please answer the following questions 1 through 30QUESTION 1The .pdfPlease answer the following questions 1 through 30QUESTION 1The .pdf
Please answer the following questions 1 through 30QUESTION 1The .pdfbarristeressaseren71
 
Java Foundations: Methods
Java Foundations: MethodsJava Foundations: Methods
Java Foundations: MethodsSvetlin Nakov
 

Similar to All based on Zybooks = AP Java with zylabsPlease answer all questi.pdf (20)

1 Midterm Preview Time allotted 50 minutes CS 11.docx
1  Midterm Preview Time allotted 50 minutes CS 11.docx1  Midterm Preview Time allotted 50 minutes CS 11.docx
1 Midterm Preview Time allotted 50 minutes CS 11.docx
 
Computer java programs
Computer java programsComputer java programs
Computer java programs
 
Test final jav_aaa
Test final jav_aaaTest final jav_aaa
Test final jav_aaa
 
Introduction to python programming ( part-2 )
Introduction to python programming ( part-2 )Introduction to python programming ( part-2 )
Introduction to python programming ( part-2 )
 
Week 4
Week 4Week 4
Week 4
 
CMIS 141 7984 Introductory Programming (2158)A non-local boole.docx
CMIS 141 7984 Introductory Programming (2158)A non-local boole.docxCMIS 141 7984 Introductory Programming (2158)A non-local boole.docx
CMIS 141 7984 Introductory Programming (2158)A non-local boole.docx
 
05. Java Loops Methods and Classes
05. Java Loops Methods and Classes05. Java Loops Methods and Classes
05. Java Loops Methods and Classes
 
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
Oracle Certified Associate (OCA) Java SE 8 Programmer II (1Z0-809) - Practice...
 
Topic20Arrays_Part2.ppt
Topic20Arrays_Part2.pptTopic20Arrays_Part2.ppt
Topic20Arrays_Part2.ppt
 
00_Introduction to Java.ppt
00_Introduction to Java.ppt00_Introduction to Java.ppt
00_Introduction to Java.ppt
 
Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]Lec 8 03_sept [compatibility mode]
Lec 8 03_sept [compatibility mode]
 
Python for Machine Learning
Python for Machine LearningPython for Machine Learning
Python for Machine Learning
 
Comp102 lec 5.1
Comp102   lec 5.1Comp102   lec 5.1
Comp102 lec 5.1
 
Page 1 Multiple Choice QuestionsQuestion 1.1. (TCO 1) What.docx
Page 1 Multiple Choice QuestionsQuestion 1.1. (TCO 1) What.docxPage 1 Multiple Choice QuestionsQuestion 1.1. (TCO 1) What.docx
Page 1 Multiple Choice QuestionsQuestion 1.1. (TCO 1) What.docx
 
Review version 4
Review version 4Review version 4
Review version 4
 
Please answer the following questions 1 through 30QUESTION 1The .pdf
Please answer the following questions 1 through 30QUESTION 1The .pdfPlease answer the following questions 1 through 30QUESTION 1The .pdf
Please answer the following questions 1 through 30QUESTION 1The .pdf
 
basic concepts
basic conceptsbasic concepts
basic concepts
 
10. Recursion
10. Recursion10. Recursion
10. Recursion
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programming
 
Java Foundations: Methods
Java Foundations: MethodsJava Foundations: Methods
Java Foundations: Methods
 

More from deepakarora871

please show stepsworking thanks Simplify Sin theta (cosec theta - s.pdf
please show stepsworking thanks Simplify Sin theta (cosec theta - s.pdfplease show stepsworking thanks Simplify Sin theta (cosec theta - s.pdf
please show stepsworking thanks Simplify Sin theta (cosec theta - s.pdfdeepakarora871
 
mutations in the LDL receptor are linked to familial hypercholestero.pdf
mutations in the LDL receptor are linked to familial hypercholestero.pdfmutations in the LDL receptor are linked to familial hypercholestero.pdf
mutations in the LDL receptor are linked to familial hypercholestero.pdfdeepakarora871
 
Name at least three ancillary departments in a hospital that dire.pdf
Name at least three ancillary departments in a hospital that dire.pdfName at least three ancillary departments in a hospital that dire.pdf
Name at least three ancillary departments in a hospital that dire.pdfdeepakarora871
 
Linear Algebra QuestionI have been trying at these for hours. I ca.pdf
Linear Algebra QuestionI have been trying at these for hours. I ca.pdfLinear Algebra QuestionI have been trying at these for hours. I ca.pdf
Linear Algebra QuestionI have been trying at these for hours. I ca.pdfdeepakarora871
 
Match the following parts of an EKG with what part of the heartbeat t.pdf
Match the following parts of an EKG with what part of the heartbeat t.pdfMatch the following parts of an EKG with what part of the heartbeat t.pdf
Match the following parts of an EKG with what part of the heartbeat t.pdfdeepakarora871
 
Let X = U+V, U is exponentially distributed with mean = 2 and V is a.pdf
Let X = U+V, U is exponentially distributed with mean = 2 and V is a.pdfLet X = U+V, U is exponentially distributed with mean = 2 and V is a.pdf
Let X = U+V, U is exponentially distributed with mean = 2 and V is a.pdfdeepakarora871
 
Lets try to summarize Darwins observations that drive changes in .pdf
Lets try to summarize Darwins observations that drive changes in .pdfLets try to summarize Darwins observations that drive changes in .pdf
Lets try to summarize Darwins observations that drive changes in .pdfdeepakarora871
 
In a single-phase region of a p-v-T diagram, which of the following a.pdf
In a single-phase region of a p-v-T diagram, which of the following a.pdfIn a single-phase region of a p-v-T diagram, which of the following a.pdf
In a single-phase region of a p-v-T diagram, which of the following a.pdfdeepakarora871
 
If the CFTR doesnt work correctly due to a mutation, Cl^- movement .pdf
If the CFTR doesnt work correctly due to a mutation, Cl^- movement .pdfIf the CFTR doesnt work correctly due to a mutation, Cl^- movement .pdf
If the CFTR doesnt work correctly due to a mutation, Cl^- movement .pdfdeepakarora871
 
How does the Drosophila embryo get its pair-rule stripes How is the .pdf
How does the Drosophila embryo get its pair-rule stripes How is the .pdfHow does the Drosophila embryo get its pair-rule stripes How is the .pdf
How does the Drosophila embryo get its pair-rule stripes How is the .pdfdeepakarora871
 
Explain the difference between an assumption and a constraint.So.pdf
Explain the difference between an assumption and a constraint.So.pdfExplain the difference between an assumption and a constraint.So.pdf
Explain the difference between an assumption and a constraint.So.pdfdeepakarora871
 
Each group should plot on graph paper the ½ life of the radioisotope.pdf
Each group should plot on graph paper the ½ life of the radioisotope.pdfEach group should plot on graph paper the ½ life of the radioisotope.pdf
Each group should plot on graph paper the ½ life of the radioisotope.pdfdeepakarora871
 
Dr. Liu did a genetic screen for yeast cells that fail to synthesize .pdf
Dr. Liu did a genetic screen for yeast cells that fail to synthesize .pdfDr. Liu did a genetic screen for yeast cells that fail to synthesize .pdf
Dr. Liu did a genetic screen for yeast cells that fail to synthesize .pdfdeepakarora871
 
Children with Down Syndrome generally show a pattern of retarded men.pdf
Children with Down Syndrome generally show a pattern of retarded men.pdfChildren with Down Syndrome generally show a pattern of retarded men.pdf
Children with Down Syndrome generally show a pattern of retarded men.pdfdeepakarora871
 
Choose the statement that describes the first stage of phagocytosis .pdf
Choose the statement that describes the first stage of phagocytosis  .pdfChoose the statement that describes the first stage of phagocytosis  .pdf
Choose the statement that describes the first stage of phagocytosis .pdfdeepakarora871
 
Are logarithms prolems used for career jobsSolutionLogarithmi.pdf
Are logarithms prolems used for career jobsSolutionLogarithmi.pdfAre logarithms prolems used for career jobsSolutionLogarithmi.pdf
Are logarithms prolems used for career jobsSolutionLogarithmi.pdfdeepakarora871
 
a) The following is a list of terms to do with how digital informati.pdf
a) The following is a list of terms to do with how digital informati.pdfa) The following is a list of terms to do with how digital informati.pdf
a) The following is a list of terms to do with how digital informati.pdfdeepakarora871
 
5. What is the difference between mutually exclusive alternatives and.pdf
5. What is the difference between mutually exclusive alternatives and.pdf5. What is the difference between mutually exclusive alternatives and.pdf
5. What is the difference between mutually exclusive alternatives and.pdfdeepakarora871
 
“Our solar system is a molecule on a snowflake on the tip of the ice.pdf
“Our solar system is a molecule on a snowflake on the tip of the ice.pdf“Our solar system is a molecule on a snowflake on the tip of the ice.pdf
“Our solar system is a molecule on a snowflake on the tip of the ice.pdfdeepakarora871
 
write the exponential decay function 15. Paleontology Carbon-14 i.pdf
write the exponential decay function 15. Paleontology Carbon-14 i.pdfwrite the exponential decay function 15. Paleontology Carbon-14 i.pdf
write the exponential decay function 15. Paleontology Carbon-14 i.pdfdeepakarora871
 

More from deepakarora871 (20)

please show stepsworking thanks Simplify Sin theta (cosec theta - s.pdf
please show stepsworking thanks Simplify Sin theta (cosec theta - s.pdfplease show stepsworking thanks Simplify Sin theta (cosec theta - s.pdf
please show stepsworking thanks Simplify Sin theta (cosec theta - s.pdf
 
mutations in the LDL receptor are linked to familial hypercholestero.pdf
mutations in the LDL receptor are linked to familial hypercholestero.pdfmutations in the LDL receptor are linked to familial hypercholestero.pdf
mutations in the LDL receptor are linked to familial hypercholestero.pdf
 
Name at least three ancillary departments in a hospital that dire.pdf
Name at least three ancillary departments in a hospital that dire.pdfName at least three ancillary departments in a hospital that dire.pdf
Name at least three ancillary departments in a hospital that dire.pdf
 
Linear Algebra QuestionI have been trying at these for hours. I ca.pdf
Linear Algebra QuestionI have been trying at these for hours. I ca.pdfLinear Algebra QuestionI have been trying at these for hours. I ca.pdf
Linear Algebra QuestionI have been trying at these for hours. I ca.pdf
 
Match the following parts of an EKG with what part of the heartbeat t.pdf
Match the following parts of an EKG with what part of the heartbeat t.pdfMatch the following parts of an EKG with what part of the heartbeat t.pdf
Match the following parts of an EKG with what part of the heartbeat t.pdf
 
Let X = U+V, U is exponentially distributed with mean = 2 and V is a.pdf
Let X = U+V, U is exponentially distributed with mean = 2 and V is a.pdfLet X = U+V, U is exponentially distributed with mean = 2 and V is a.pdf
Let X = U+V, U is exponentially distributed with mean = 2 and V is a.pdf
 
Lets try to summarize Darwins observations that drive changes in .pdf
Lets try to summarize Darwins observations that drive changes in .pdfLets try to summarize Darwins observations that drive changes in .pdf
Lets try to summarize Darwins observations that drive changes in .pdf
 
In a single-phase region of a p-v-T diagram, which of the following a.pdf
In a single-phase region of a p-v-T diagram, which of the following a.pdfIn a single-phase region of a p-v-T diagram, which of the following a.pdf
In a single-phase region of a p-v-T diagram, which of the following a.pdf
 
If the CFTR doesnt work correctly due to a mutation, Cl^- movement .pdf
If the CFTR doesnt work correctly due to a mutation, Cl^- movement .pdfIf the CFTR doesnt work correctly due to a mutation, Cl^- movement .pdf
If the CFTR doesnt work correctly due to a mutation, Cl^- movement .pdf
 
How does the Drosophila embryo get its pair-rule stripes How is the .pdf
How does the Drosophila embryo get its pair-rule stripes How is the .pdfHow does the Drosophila embryo get its pair-rule stripes How is the .pdf
How does the Drosophila embryo get its pair-rule stripes How is the .pdf
 
Explain the difference between an assumption and a constraint.So.pdf
Explain the difference between an assumption and a constraint.So.pdfExplain the difference between an assumption and a constraint.So.pdf
Explain the difference between an assumption and a constraint.So.pdf
 
Each group should plot on graph paper the ½ life of the radioisotope.pdf
Each group should plot on graph paper the ½ life of the radioisotope.pdfEach group should plot on graph paper the ½ life of the radioisotope.pdf
Each group should plot on graph paper the ½ life of the radioisotope.pdf
 
Dr. Liu did a genetic screen for yeast cells that fail to synthesize .pdf
Dr. Liu did a genetic screen for yeast cells that fail to synthesize .pdfDr. Liu did a genetic screen for yeast cells that fail to synthesize .pdf
Dr. Liu did a genetic screen for yeast cells that fail to synthesize .pdf
 
Children with Down Syndrome generally show a pattern of retarded men.pdf
Children with Down Syndrome generally show a pattern of retarded men.pdfChildren with Down Syndrome generally show a pattern of retarded men.pdf
Children with Down Syndrome generally show a pattern of retarded men.pdf
 
Choose the statement that describes the first stage of phagocytosis .pdf
Choose the statement that describes the first stage of phagocytosis  .pdfChoose the statement that describes the first stage of phagocytosis  .pdf
Choose the statement that describes the first stage of phagocytosis .pdf
 
Are logarithms prolems used for career jobsSolutionLogarithmi.pdf
Are logarithms prolems used for career jobsSolutionLogarithmi.pdfAre logarithms prolems used for career jobsSolutionLogarithmi.pdf
Are logarithms prolems used for career jobsSolutionLogarithmi.pdf
 
a) The following is a list of terms to do with how digital informati.pdf
a) The following is a list of terms to do with how digital informati.pdfa) The following is a list of terms to do with how digital informati.pdf
a) The following is a list of terms to do with how digital informati.pdf
 
5. What is the difference between mutually exclusive alternatives and.pdf
5. What is the difference between mutually exclusive alternatives and.pdf5. What is the difference between mutually exclusive alternatives and.pdf
5. What is the difference between mutually exclusive alternatives and.pdf
 
“Our solar system is a molecule on a snowflake on the tip of the ice.pdf
“Our solar system is a molecule on a snowflake on the tip of the ice.pdf“Our solar system is a molecule on a snowflake on the tip of the ice.pdf
“Our solar system is a molecule on a snowflake on the tip of the ice.pdf
 
write the exponential decay function 15. Paleontology Carbon-14 i.pdf
write the exponential decay function 15. Paleontology Carbon-14 i.pdfwrite the exponential decay function 15. Paleontology Carbon-14 i.pdf
write the exponential decay function 15. Paleontology Carbon-14 i.pdf
 

Recently uploaded

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 

Recently uploaded (20)

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 

All based on Zybooks = AP Java with zylabsPlease answer all questi.pdf

  • 1. All based on Zybooks = AP Java with zylabs Please answer all questions - no explanation of answers needed QUESTION 1 char[][] table = new char[10][5]; How many rows are in the array seen in the accompanying figure? 0 5 10 15 QUESTION 2 The standard output object in Java is ____. output System.out Sys.out System.in QUESTION 3 The length of the string "first java program" is: 16 18 19 20 1 points QUESTION 4 The loop condition of a while loop is reevaluated before every iteration of the loop. True False 1 points QUESTION 5 If str1 is “Hello” and str2 is “Hi”, which of the following could not be a result of str1.compareTo(str2);? -9 -5 -1 1
  • 2. 1 points QUESTION 6 Both System.out.println and System.out.print can be used to output a string on the standard output device. True False 1 points QUESTION 7 In a method call statement, when passing an array as an actual parameter, you use only its name. True False 1 points QUESTION 8 Which of the following is true about a while loop? The body of the loop is executed at least once. The logical expression controlling the loop is evaluated before the loop is entered and after the loop exists. The body of the loop may not execute at all. It is a post-test loop 1 points QUESTION 9 int x, y; if (x < 4) y = 2; else if (x > 4) { if (x > 7) y = 4; else y = 6; } else y = 8; Based on the code above, what is the value of y if x = 9?
  • 3. 2 4 6 8 1 points QUESTION 10 The array index can be any nonnegative integer less than the array size. True False 1 points QUESTION 11 When a program executes, the first statement to execute is always the first statement in the main method. True False 1 points QUESTION 12 Java stores two-dimensional arrays in a row order form in computer memory. True False 1 points QUESTION 13 The statement dataType[][][] arrayName; would declare a two-dimensional array. True False 1 points QUESTION 14 All the methods defined in a class must have different names. True False 1 points QUESTION 15 Which of the following is NOT a reserved word in Java? double throws static
  • 4. num 1 points QUESTION 16 Given the declaration int[] list = new int[50]; the statement System.out.println(list[0] + "..." + list[49]); outputs all 50 components of the array list. True False 1 points QUESTION 17 In the case of an infinite while loop, the while expression (that is, the loop condition) is always true. True False 1 points QUESTION 18 Consider the following program. public class CircleArea { static Scanner console = new Scanner(System.in); static final double PI = 3.14; public static void main(String[]args) { doubler; double area; r = console.nextDouble(); area = PI * r * r; System.out.println("Area = " + area);
  • 5. } } To successfully compile this program, which of the following import statement is required? import java.io.Scanner; import java.util.Scanner; import java.lang.Scanner; No import statement is required 1 points QUESTION 19 An identifier can be any sequence of characters and integers. True False 1 points QUESTION 20 A single array can hold elements of many different data types. True False 1 points QUESTION 21 Consider the following program. // Insertion Point 1 public class CircleArea { // Insertion Point 2 static final float PI = 3.14 public static void main(String[]args) { //Insertion Point 3 float r = 2.0; float area; area = PI * r * r; System.out.println("Area = " + area);
  • 6. } // Insertion Point 4 } In the above code, where do the import statements belong? Insertion Point 1 Insertion Point 2 Insertion Point 3 Insertion Point 4 1 points QUESTION 22 Suppose that x is an int variable. Which of the following expressions always evaluates to false? (x > 0) || (x <= 0) (x > 0) || (x == 0) (x > 0) && ( x <= 0) (x >= 0) && (x == 0) 1 points QUESTION 23 What is the value of alpha[4] after the following code executes? int[] alpha = new int[5]; for (int j = 0; j < 5; j++) alpha[j] = 2 * j - 1; one three five seven 1 points QUESTION 24 If a = 4; and b = 3;, then after the statement a = b; executes, the value of b is 4 and the value of a is 3. True False 1 points QUESTION 25
  • 7. The expression !(x <= 0) is true only if x is a positive number. True False 1 points QUESTION 26 In a return method, the last line of the method must be a return statement. True False 1 points QUESTION 27 The expression (int)8.7 evaluates to ____. 8 8.0 9.0 9 1 points QUESTION 28 A loop is a control structure that causes certain statements to be executed over and over until certain conditions are met. True False 1 points QUESTION 29 What is stored in alpha after the following code executes? int[] alpha = new int[5]; for (int j = 0; j < 5; j++) { alpha[j] = 2 * j; if (j % 2 == 1) alpha[j - 1] = alpha[j] + j; } alpha = {0, 2, 4, 6, 8} alpha = {3, 2, 9, 6, 8}
  • 8. alpha = {0, 3, 4, 7, 8} alpha = {0, 2, 9, 6, 8} 1 points QUESTION 30 Suppose that x and y are int variables and x = 7 and y = 8. After the statement: x = x * y - 2; executes, the value of x is ____. 42 54 56 58 1 points QUESTION 31 A counter-controlled loop should be used when the programmer knows the exact number of loop iterations are needed. True False 1 points QUESTION 32 In Java, a period is used to terminate a statement. True False 1 points QUESTION 33 In Java, return is a reserved word. True False 1 points QUESTION 34 When an array reference is passed to a method, the method can modify the elements of the array object. True False 1 points QUESTION 35 A local identifier is an identifier that is declared within a method or block and that is visible only within that method or block.
  • 9. True False 1 points QUESTION 36 An expression such as str.length(); is an example of a(n) ____. system call object call class method call 1 points QUESTION 37 Suppose str1 and str2 are String variables. The expression (str1 == str2) determines whether str1 and str2 reference the same String object. True False 1 points QUESTION 38 Just like the nesting of loops, Java allows the nesting of methods. True False 1 points QUESTION 39 Suppose console is a Scanner object initialized with the standard input device. The expression console.nextInt(); is used to read one int value and the expression console.nextDouble(); is used to read two int values. True False 1 points QUESTION 40 A compiler translates the assembly language instructions into machine language. True False 1 points QUESTION 41 An identifier can be declared anywhere including within a class, and outside of every method definition (and every block).
  • 10. True False 1 points QUESTION 42 The following for loop executes 21 times. (Assume all variables are properly declared.) for (i = 1; i <= 20; i = i + 1) System.out.println(i); True False 1 points QUESTION 43 Which of the following is the array subscripting operator in Java? . {} new [] 1 points QUESTION 44 char[][] table = new char[10][5]; How many columns are in the array seen in the accompanying figure? 0 5 10 15 1 points QUESTION 45 The digit 0 or 1 is called a ____. bit bytecode Unicode hexcode 1 points QUESTION 46 The output of the following Java code is: Stoor. int count = 5;
  • 11. System.out.print("Sto"); do { System.out.print('o'); count--; } while (count >= 5); System.out.println('r'); True False 1 points QUESTION 47 The expression (double)(5 + 4) evaluates to ____. 8 9 9.0 10.0 1 points QUESTION 48 In Java, !, &&, and || are called logical operators. True False 1 points QUESTION 49 int x, y; if (x < 4) y = 2; else if (x > 4) { if (x > 7) y = 4; else y = 6;
  • 12. } else y = 8; Based on the code above, what is the value of y if x = 4? 2 4 6 8 1 points QUESTION 50 What is the output of the following code? int count; int num = 2; for (count = 1; count < 2; count++) { num = num + 3; System.out.print(num + " "); } System.out.println(); 5 5 8 2 5 8 5 8 11 0 5 10 15 Solution Question 1: char[][] table = new char[10][5];
  • 13. How many rows are in the array seen in the accompanying figure? Answer : 5 Question 2: The standard output object in Java is ____. Answer : System.out Question 3: The length of the string "first java program" is: Answer : 18