Java-all quizes
Java-all quizes
Dashboard / My courses / Java / Regular Expression / Post-Quiz - Regular Expression
Quiz review
Started on Sunday, 28 January 2024, 7:43 PM
State Finished
Completed on Sunday, 28 January 2024, 7:47 PM
Time taken 4 mins 14 secs
Marks 10.00/10.00
Grade 100.00 out of 100.00
Question 1
Correct
The first name of a person should contain only alphabets and space.
44953
Which of the following regular expression will match the requirement?
Select one:
a. [a-zA-Z ]+
b. [a-zA-Z ]
c. [\\s]+
d. [\\s]
Which of the following text when matched with the regular expression “[a-zA-Z&&[^aeiou]]+” will return true?
c. My
d. must
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121712&cmid=5255 1/4
2/19/24, 8:06 PM Post-Quiz - Regular Expression: Attempt review
Question 3
Correct
Select one:
True
False
Question 4
Correct
44953
What is the regular expression to match a whitespace character in a string?
Select one:
\s
\d
\S
\w
Question 5
Correct
44953
Mark 1.00 out of 1.00
Statement 2 : Matcher class matches the regular expression against the text provided
Which of the following is true?
Select one:
a. Both Statement 1 and 2 are correct 44953
b. Statement 2 alone is correct.
d.
Statement 1 alone is correct.
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121712&cmid=5255 2/4
2/19/24, 8:06 PM Post-Quiz - Regular Expression: Attempt review
Question 6
Correct
Select one:
[0-9]
[A-Z]
[a-z]
[a-zA-Z]
Question 7
Correct
44953
Predict the output of the below code :
import java.util.regex.*;
Pattern p = Pattern.compile(".ech");
Matcher m = p.matcher("tech");
boolean b = m.matches();
System.out.println(b);
}
}
44953
Select one:
a. compile time error
b.
true
c. false
d. Runtime Error
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121712&cmid=5255 3/4
2/19/24, 8:06 PM Post-Quiz - Regular Expression: Attempt review
Question 8
Correct
Select one:
True
False
Question 9
Correct
44953
What is the regular expression to match any email address in a string?
Select one:
[A-Za-z0-9.%+-]+@[A-Za-z0-9.-]+
[A-Za-z0-9.%+-]+@[A-Za-z0-9.-]+.[A-Z|a-z]{2,}
[A-Za-z0-9.%+-]+
[A-Za-z0-9.%+-]+.[A-Z|a-z]{2,}
Question 10
Correct
44953
Mark 1.00 out of 1.00
What is the regular expression to match any date in the format "yyyy-mm-dd" in a string?
Select one:
\d{2}-\d{2}-\d{4}
\d{2}/\d{2}/\d{4}
\d{4}-\d{2}-\d{2}
\d{4}/\d{2}/\d{2}
◄ Password Validator
Jump to...
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121712&cmid=5255 4/4
2/19/24, 8:05 PM Pre-Quiz - Regular expression: Attempt review
Dashboard / My courses / Java / Regular Expression / Pre-Quiz - Regular expression
Quiz review
Started on Sunday, 28 January 2024, 7:37 PM
State Finished
Completed on Sunday, 28 January 2024, 7:38 PM
Time taken 52 secs
Marks 4.00/4.00
Grade 100.00 out of 100.00
Question 1
Correct
44953
String name="Sudha learns Oracle";
System.out.println(name.substring(7,12));
What is the output of the above code?
Select one:
a.
earns
b. learn
44953
c. learns
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121608&cmid=5245 1/3
2/19/24, 8:05 PM Pre-Quiz - Regular expression: Attempt review
Question 2
Correct
String emailId="john#global.com";
System.out.println(emailId.indexOf('@'));
Select one:
a. 0
c. -1
d. 1
What can be the parameters for the indexOf method in String class?
44953
Select one or more:
a. double
b. float
c. String
d. int
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121608&cmid=5245 2/3
2/19/24, 8:05 PM Pre-Quiz - Regular expression: Attempt review
Question 4
Correct
char c=course.charAt(16);
System.out.println(c);
Select one:
a.
Compilation error
b. g
c.
44953
ArrayIndexOutOfBoundsException
d.
StringIndexOutOfBoundsException
Jump to...
44953
Regular Expression-Intro ►
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121608&cmid=5245 3/3
2/19/24, 8:05 PM Post-Quiz Arrays and Strings: Attempt review
Dashboard / My courses / Java / Arrays and Strings / Post-Quiz Arrays and Strings
Quiz review
Started on Sunday, 28 January 2024, 7:33 PM
State Finished
Completed on Sunday, 28 January 2024, 7:37 PM
Time taken 3 mins 41 secs
Marks 11.00/11.00
Grade 100.00 out of 100.00
Feedback Congratulations!! You have passed by securing more than 80%
Question 1
Correct
2.if(name.equals(cname))
3.if(name==compname)
4.if(name.equals(compname))
Identify the output.
c.
Line 3,4 will return true.
44953
Your answer is correct.
The correct answer is: Line 1,2,4 will return true.
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121538&cmid=5243 1/6
2/19/24, 8:05 PM Post-Quiz Arrays and Strings: Attempt review
Question 2
Correct
class ArrayTest {
primes[0] = "a";
System.out.println(primes[0]);
}
What will be the result of compiling and executing the above code?
Select one:
44953
a.
Runtime exception
c.
ArrayStoreException
d. a
Question 3
Correct
44953
Mark 1.00 out of 1.00
StringBuilder is less efficient and slower than StringBuffer. State true or false.
Select one:
True
False
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121538&cmid=5243 2/6
2/19/24, 8:05 PM Post-Quiz Arrays and Strings: Attempt review
Question 4
Correct
Select one:
a.
lang
b.
none of the options
c. io
d.
util
class TestArray {
44953
int arr_sample[] = new int[2];
System.out.println(arr_sample[0]);
}
What will be the result of compiling and executing the above code?
Select one:
a. The program compiles and prints 0 when executed.
b.
The program compiles and runs but the results are not predictable because of un-initialized memory being read.
44953
c. The program does not compile because arr_sample[0] is being read before being initialized.
d.
The program generates a runtime exception because arr_sample[0] is being read before being initialized.
The correct answer is: The program compiles and prints 0 when executed.
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121538&cmid=5243 3/6
2/19/24, 8:05 PM Post-Quiz Arrays and Strings: Attempt review
Question 6
Correct
Select one:
a.
an immutable String
b. a mutable String
Question 7
44953
Correct
Select one:
True
False
Question 8
44953
Correct
e.
int [ ]studentId;
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121538&cmid=5243 4/6
2/19/24, 8:05 PM Post-Quiz Arrays and Strings: Attempt review
Question 9
Correct
class Output {
Select one:
a.
10 5
b.
c.
05
44953
0 10
d. 5 10
Question 10
Correct
Advanced for loop is better as it is less error prone as we don't need to deal with index.
Select one:
True
False
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121538&cmid=5243 5/6
2/19/24, 8:05 PM Post-Quiz Arrays and Strings: Attempt review
Question 11
Correct
Given a one-dimensional array arr, what is the correct way of getting the number of elements in arr?
Select one:
a.
arr.length-1
b.
arr.length()
c.
arr.length()-1
d. arr.length
44953
The correct answer is: arr.length
Jump to...
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121538&cmid=5243 6/6
2/19/24, 8:05 PM Test Your Understanding - Arrays and Strings: Attempt review
Dashboard / My courses / Java / Arrays and Strings / Test Your Understanding - Arrays and Strings
Quiz review
Started on Sunday, 28 January 2024, 7:20 PM
State Finished
Completed on Sunday, 28 January 2024, 7:32 PM
Time taken 11 mins 59 secs
Marks 20.67/21.00
Grade 98.41 out of 100.00
Feedback Congratulations!!! You have passed by securing more than 80%
44953
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121301&cmid=5221 1/16
2/19/24, 8:05 PM Test Your Understanding - Arrays and Strings: Attempt review
Question 1
Correct
What will be the content of array variable table after executing the following code?
{
int []table[]=new int[5][5];
44953
if(j == i)
table[i][j] = 1;
System.out.print(table[i][j]);
}
else
table[i][j] = 0;
System.out.print(table[i][j]);
}
}
44953
System.out.println("\n");
}
}
Select one:
a.
100
010
001
44953
b.
Compilation error
c.
100
110
111
d.
000
000
000
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121301&cmid=5221 2/16
2/19/24, 8:05 PM Test Your Understanding - Arrays and Strings: Attempt review
"table" is a 2 dimensional array with 5 rows and 5 columns. It is iterated from 0 through 3 and during each iteration j==i (iteration variables) is
checked. When j==i evaluates to true, the index is assigned the value "1" and printed. Else, assigned "0'" and printed.
The correct answer is:
100
010
001
Question 2
Correct
44953
Your answer is correct.
The correct answer is:
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121301&cmid=5221 3/16
2/19/24, 8:05 PM Test Your Understanding - Arrays and Strings: Attempt review
Question 3
Correct
class String_demo
{
int ascii[] = { 65, 66, 67, 68};
System.out.println(s);
44953
Select one:
a. CDA
b. ABC
c. ABCD
d. BCD
44953
An integer array is initialized with values 65, 66, 67 and 68. Its reference is "ascii". A new string object is initialized with this reference
such that the elements from index 1 through 3 alone gets copied as "characters". This object is referred by "s". Printing this object will
output BCD which are the char-equivalents of 66, 67 and 68.
The correct answer is: BCD
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121301&cmid=5221 4/16
2/19/24, 8:05 PM Test Your Understanding - Arrays and Strings: Attempt review
Question 4
Correct
Fill in appropriately.
Note : In heap memory does not include String pool, though pool is inside heap.
The "new" keyword allows memory for storing String to be allocated in the "heap" . Otherwise, memory is allocated in string pool.
The correct answer is:
44953
Fill in appropriately.
String st3="JAVA"
Note : In heap memory does not include String pool, though pool is inside heap.
Question 5
Correct
44953
Mark 1.00 out of 1.00
Given a one dimensional array arr, what is the correct way of getting the number of elements in arr is arr.length
Given a one dimensional array arr, what is the correct way of getting the number of elements in arr is [arr.length]
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121301&cmid=5221 5/16
2/19/24, 8:05 PM Test Your Understanding - Arrays and Strings: Attempt review
Question 6
Correct
class String_demo
System.out.println(s);
Select one:
a. b
44953
b. c
c. abc
d. a
A character array is initialized with 'a', 'b' and 'c' and the array reference is chars. Printing this reference will output abc.
A "new" string object is initialized with this reference and this object is referred by "s". Printing this reference will output abc.
The correct answer is: abc
44953
Question 7
Correct
Select one:
a. alloc
b. new
c. calloc
44953
d. malloc
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121301&cmid=5221 6/16
2/19/24, 8:05 PM Test Your Understanding - Arrays and Strings: Attempt review
Question 8
Correct
s.deleteCharAt(0);
Select one:
a. ello
b. hell
c. llo
d. Hel
Question 9
Correct
{
44953
public static void main(String[] args)
Select one:
44953
a. The program has a runtime error because the array elements are not initialized.
b. The program has a compile error because the size of the array wasn't specified when declaring the array.
c. The program has a runtime error because the array element x[0] is not defined.
The "new" keyword allows memory for storing integer elements in an array to be created in the "heap" and the memory is initialized with "default of integer"
which is 0.
The correct answer is: The program runs fine and displays x[0] is 0.
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121301&cmid=5221 7/16
2/19/24, 8:05 PM Test Your Understanding - Arrays and Strings: Attempt review
Question 10
Correct
int arr[4]={};
System.out.print(arr[0]);
}
}
44953
Select one:
a. Runtime error
b. 0
c. Garbage error
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121301&cmid=5221 8/16
2/19/24, 8:05 PM Test Your Understanding - Arrays and Strings: Attempt review
Question 11
Correct
class Evaluate
int n = 6;
n = arr[arr[n] / 2];
System.out.println(arr[n] / 2);
44953
}
Select one:
a. 6
b. 3
c. 1
d. 0
44953
When n is initialized with value 6, n = arr[arr[n] / 2] evaluates to n = 3. Now, printing arr[n] / 2 will output 1.
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121301&cmid=5221 9/16
2/19/24, 8:05 PM Test Your Understanding - Arrays and Strings: Attempt review
Question 12
Correct
class array_output
array_variable[i] = 'i';
System.out.print(array_variable[i] + "");
44953
}
Select one:
a. i j k l m n o p q r
b. 1 2 3 4 5 6 7 8 9 10
c. 0 1 2 3 4 5 6 7 8 9 10
d. i i i i i i i i i i
44953
array_variable is a character array that can hold 10 characters. The for loop gets iterated for 10 times. During each iteration, the array index is assigned with
the character "i" and printed alongside. Hence the output "iiiiiiiiii".
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121301&cmid=5221 10/16
2/19/24, 8:05 PM Test Your Understanding - Arrays and Strings: Attempt review
Question 13
Correct
int[] y = x;
x = new int[2];
44953
}
Select one:
a. 0 0 0 0
b. 0 0
c. 1 2 3 4
d. 1 2
44953
Array x is initialized with 4 values and this means reference "x" contains the starting address of the array. This address is copied to the
array reference "y". This mean the 4 values can now be accessed with "y" as well. Then the reference x is assigned with a new array's
starting address whose length is 2. Hence the iteration outputs 1 2
The correct answer is: 1 2
Question 14
Correct
44953
+ operator can be used to concatenate two or more String objects in java. State true or false.
Select one:
True
False
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121301&cmid=5221 11/16
2/19/24, 8:05 PM Test Your Understanding - Arrays and Strings: Attempt review
Question 15
Correct
Select one:
a. length()
b. size()
c. len
d. length
44953
length()
Question 16
Correct
String s1 = “one”;
String s2 = s1.concat(“two”);
44953
Select one:
a. onetwo
b. one
c. twoone
d. two
44953
The string "two" referred by s2 is "concatenated to" the string "one" referred by s1.
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121301&cmid=5221 12/16
2/19/24, 8:05 PM Test Your Understanding - Arrays and Strings: Attempt review
Question 17
Partially correct
What is special about string objects as compared to objects of other derived types?
c. You can create string objects without or without using new operator
44953
provides string constant pool to store the string objects
Question 18
Correct
Select one:
True
False
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121301&cmid=5221 13/16
2/19/24, 8:05 PM Test Your Understanding - Arrays and Strings: Attempt review
Question 19
Correct
class Output
{
44953
Select one:
a. 0 5
b. 10 5
c. 0 10
d. 5 10
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121301&cmid=5221 14/16
2/19/24, 8:05 PM Test Your Understanding - Arrays and Strings: Attempt review
Question 20
Correct
Given:
1. public class MyLogger {
2. private StringBuilder logger = new StringBuuilder();
3. public void log(String message, String user) {
4. logger.append(message);
5. logger.append(user);
6. }
7. }
The programmer must guarantee that a single MyLogger object works properly for a multi-threaded system.
How must this code be changed to be thread-safe?
Select one:
a. No change is necessary, the current MyLogger code is already thread-safe.
44953
b. Replace StringBuilder with just a String object and use the string concatenation (+=) within the log method.
StringBuffer is synchronized and therefore thread-safe. StringBuilder is compatible with StringBuffer API but with no guarantee of
synchronization. Because it’s not a thread-safe implementation, it is faster and it is recommended to be used only in places where
there’s no need for thread safety.
The correct answer is: Replace StringBuilder with StringBuffer
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121301&cmid=5221 15/16
2/19/24, 8:05 PM Test Your Understanding - Arrays and Strings: Attempt review
Question 21
Correct
{
public static void main(String argv[])
{
int ary[]=new int[]{1,2,3};
System.out.println(ary[1]);
}
44953
Select one:
a. 1
c. 2
The array ary is initialized with 3 elements and the element at the first index is 2.
The correct answer is: 2
◄ String
44953
Jump to...
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121301&cmid=5221 16/16
2/19/24, 8:04 PM Pre-Quiz Arrays and Strings: Attempt review
Dashboard / My courses / Java / Arrays and Strings / Pre-Quiz Arrays and Strings
Quiz review
Started on Sunday, 28 January 2024, 7:15 PM
State Finished
Completed on Sunday, 28 January 2024, 7:19 PM
Time taken 4 mins 6 secs
Marks 8.00/8.00
Grade 100.00 out of 100.00
Feedback Congratulations!! You have passed by securing more than 80%
Question 1
Correct
Given:
public class ItemTest
44953
{
private final int id;
public ItemTest(int id) {
this.id = id;
}
public void updateId(int newId) {
id = newId;
}
public static void main(String[] args) {
44953
ItemTest fa = new ItemTest(42);
fa.updateId(69);
System.out.println(fa.id);
}
}
What is the result?
Select one:
a. CompileTime Error
b.
Runtime Error
c.
69 44953
Your answer is correct.
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121202&cmid=5214 1/6
2/19/24, 8:04 PM Pre-Quiz Arrays and Strings: Attempt review
Question 2
Correct
Select one:
a.
Constructor can be overloaded
b.
Constructor will be invoked explicitly like other methods
c.
Constructor should have same name as class name, but not case sensitive
d. Constructor of a class should not have a return type, which means the return type is void
Which two pairs of method declarations follow the JavaBeans standard for accessing this field? (Choose two.)
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121202&cmid=5214 2/6
2/19/24, 8:04 PM Pre-Quiz Arrays and Strings: Attempt review
Question 4
Correct
Select one:
a.
Used for calling the current object of the parent class.
b.
Used for calling the no argument constructor of the same class.
d.
Used for calling the current object of the same class.
44953
The correct answer is: Used for calling the no argument constructor of the same class.
Question 5
Correct
Statement 1 : When no constructor is written in a class, the compiler creates a default constructor
Statement 2 : The default constructor will implicitly invoke the default / no-argument constructor of the super class
44953
Statement 3 : If a class has a parametrized constructor alone, then the compiler will create the default constructor
Statement 4 : If a class has a parametrized constructor, it is mandatory to write a no-argument constructor
Select one:
a. 1, 2 and 4
b.
1, 2 and 3
c.
2 and 3
d.
1 and 2
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121202&cmid=5214 3/6
2/19/24, 8:04 PM Pre-Quiz Arrays and Strings: Attempt review
Question 6
Correct
class Test {
int x = 10;
System.out.println(x);
}
Select one:
a. Compile Time Error
b. 0
c. 10
d. Runtime Exception
44953
Your answer is correct.
Question 7
Correct
44953
Which members of a class can be accessed by other classes is determined by the ________________
Select one:
a. Access specifier
b. class
c. variables
d. constructor
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121202&cmid=5214 4/6
2/19/24, 8:04 PM Pre-Quiz Arrays and Strings: Attempt review
Question 8
Correct
package edu.ABC.model;
} 44953
return INTEREST_RATE;
b.
import static edu.ABC.model.Account.*;
c.
package edu.ABC.model;
return INTEREST_RATE;
}
}
d.
import edu.ABC.model.Account ;
44953
public double getInterest() {
return Account.INTEREST_RATE;
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121202&cmid=5214 5/6
2/19/24, 8:04 PM Pre-Quiz Arrays and Strings: Attempt review
}
}
Jump to...
44953
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121202&cmid=5214 6/6
2/19/24, 8:04 PM Post-Quiz - Classes and Objects, Packages: Attempt review
Dashboard / My courses / Java / Class and Objects, Date API / Post-Quiz - Classes and Objects, Packages
Quiz review
Started on Sunday, 28 January 2024, 7:07 PM
State Finished
Completed on Sunday, 28 January 2024, 7:10 PM
Time taken 3 mins 30 secs
Marks 8.00/8.00
Grade 100.00 out of 100.00
Feedback Congratulations!! You have passed by securing more than 80%
Question 1
Correct
44953
Which of the following is not a Java modifier?
Select one:
a.
protected
b. private
c.
public
d.
virtual
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121032&cmid=5213 1/7
2/19/24, 8:04 PM Post-Quiz - Classes and Objects, Packages: Attempt review
Question 2
Correct
int x = 6;
Sample p = new Sample();
p.display(x);
System.out.print(" main x = " + x);
void display(int x) {
44953
System.out.print(" display x = " + x++);
Select one:
a.
Compilation fails.
b.
display x = 6 main x = 6
c.
display x = 7 main x = 6
f.
display x = 7 main x = 7
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121032&cmid=5213 2/7
2/19/24, 8:04 PM Post-Quiz - Classes and Objects, Packages: Attempt review
Question 3
Correct
Given:
String msg;
int noOfWords;
public Message() {
msg = "Welcome";
44953
Message();
44953
Select one:
a. An exception is thrown at runtime
b. Compilation fails
d. Welcome
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121032&cmid=5213 3/7
2/19/24, 8:04 PM Post-Quiz - Classes and Objects, Packages: Attempt review
Question 4
Correct
1. package p1;
1. package p2;
44953
4. String [] names = new String[10];
6. }
7. }
Identify the statement to be written in line 5 in class TestMain to call the display method of class Test.
Select one:
a. p1.display(names);
44953
b.
display(names);
c.
p1.Test.display(names);
d.
TestMain cannot use methods in p1
e.
import p1.Test.*; display(names);
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121032&cmid=5213 4/7
2/19/24, 8:04 PM Post-Quiz - Classes and Objects, Packages: Attempt review
Question 5
Correct
return description;
this.description = description;
44953
public static void modifyDesc(Item item,String desc) {
item=new Item();
item.setDescription(desc);
it.setDescription("Gobstopper");
it2.setDescription("Fizzylifting");
it.modifyDesc(it,"Scrumdiddlyumptious");
44953
System.out.println(it.getDescription());
System.out.println(it2.getDescription());
}
}
Select one:
a. Gobstopper
Fizzylifting
b. Scrumdiddlyumptious
Fizzylifting
c. Scrumdiddlyumptious
d. Gobstopper
44953
Scrumdiddlyumptious
e. Compilation fails
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121032&cmid=5213 5/7
2/19/24, 8:04 PM Post-Quiz - Classes and Objects, Packages: Attempt review
Question 6
Correct
class X
void display(int a)
{
System.out.println("INT");
void display(double d)
44953
System.out.println("DOUBLE");
new X().display(100);
}
}
44953
Select one:
a. INT
b. Compilation Fails
c. DOUBLE
d. Ambiguity error
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121032&cmid=5213 6/7
2/19/24, 8:04 PM Post-Quiz - Classes and Objects, Packages: Attempt review
Question 7
Correct
The methods of a class with the ____________ access specifier cannot be accessed in its subclass class of different package.
Select one:
a. protected
b. default
c. public
44953
The correct answer is: default
Question 8
Correct
int x2 = 120;
System.out.println( x1 == x2 );
44953
What will be the output of the above code fragment?
Select one:
a. true
b. Compilation Error
c. false
d.
CastException
e.
Runtime Exception
Jump to...
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1121032&cmid=5213 7/7
2/19/24, 8:04 PM Test your understanding - Packages: Attempt review
Dashboard / My courses / Java / Class and Objects, Date API / Test your understanding - Packages
Quiz review
Started on Sunday, 28 January 2024, 6:51 PM
State Finished
Completed on Sunday, 28 January 2024, 6:53 PM
Time taken 1 min 59 secs
Marks 5.00/5.00
Grade 100.00 out of 100.00
Feedback Congratulations!!! You have passed by securing more than 80%
Question 1
Correct
44953
Select one:
a. 6 1 3 2 4 5
b. 6 2 1 3 4 5
c. 6 1 2 3 4 5
d. 2 6 1 3 4 5
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120771&cmid=5205 1/5
2/19/24, 8:04 PM Test your understanding - Packages: Attempt review
Question 2
Correct
return area;
}
}
select the correct statement to use the static variable PI.
44953
Your answer is correct.
}
return area;
44953
}
select the correct statement to use the static variable PI.
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120771&cmid=5205 2/5
2/19/24, 8:04 PM Test your understanding - Packages: Attempt review
Question 3
Correct
1. package model;
4. }
1. package util;
44953
5. }
6. }
What is required at line 4 in class Library to use the countBook method of Book class?
Select one:
Book.countBook();
util.Library.countBook();
countBook();
model.Book.countBook();
44953
countBook() cannot be invoked since the method is declared private.
The correct answer is: Library class cannot use the countBook method in Book class.
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120771&cmid=5205 3/5
2/19/24, 8:04 PM Test your understanding - Packages: Attempt review
Question 4
Correct
Assume class Calculator in package p1 and CalculatorService class in package p2 as shown below.
package p1;
package p2;
import p1.Calculator;
44953
public void display(){
Calculator.calculate();
What can be the valid access specifier for the calculate method in Calculator class so that it can be accessed from CalculatorService
class?
Select one:
private
44953
protected
default
public
If a method defined within a class in one package has to be invoked from outside, then that method has to be declared public.
Question 5
Correct
44953
Mark 1.00 out of 1.00
Given the class Book in packages p1 and class Main in package p2. In main to create an object of Book, which of the following are
valid.
Select one:
p1.Book bookObj=new Book();
Since the Book class is present within p1 package, it has to be accessed as "p1.Book", everytime, from package p2.
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120771&cmid=5205 4/5
2/19/24, 8:04 PM Test your understanding - Packages: Attempt review
Jump to...
44953
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120771&cmid=5205 5/5
2/19/24, 8:03 PM Test your understanding - Static: Attempt review
Dashboard / My courses / Java / Class and Objects, Date API / Test your understanding - Static
Quiz review
Started on Sunday, 28 January 2024, 6:48 PM
State Finished
Completed on Sunday, 28 January 2024, 6:51 PM
Time taken 2 mins 58 secs
Marks 4.00/5.00
Grade 80.00 out of 100.00
Feedback
Congratulations!!! You have passed by securing more than 80%
44953
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120709&cmid=5204 1/7
2/19/24, 8:03 PM Test your understanding - Static: Attempt review
Question 1
Correct
int productId;
String productName;
static int count = 0;
productId = pid;
productName=name;
44953
count++;
System.out.println("Count is "+Product.count);
}
44953
System.out.println("Count is "+Product.count);
Count is 1
Count is 3
int productId;
String productName;
productId = pid;
productName=name;
count++;
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120709&cmid=5204 2/7
2/19/24, 8:03 PM Test your understanding - Static: Attempt review
}
[System.out.println("Count is "+Product.count);]
}
}
Count is 1
Count is 3
44953
Note: You can use the same option multiple times
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120709&cmid=5204 3/7
2/19/24, 8:03 PM Test your understanding - Static: Attempt review
Question 2
Incorrect
String name;
//Line 1
}
}
44953
public void display(){
System.out.println("Employee Name"+name);
public static void display() {
System.out.println("Employee Name"+name);
From a static method, we can access only static members. Non static members cannot be accessed from static methods.
However, from a non static method, we can access both static and non static members.
The correct answers are:
44953
public static void display(){
System.out.println("Employee count "+employeeCount);
},
public void display(){
System.out.println("Employee count "+employeeCount);
},
public void display(){
System.out.println("Employee Name"+name);
}
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120709&cmid=5204 4/7
2/19/24, 8:03 PM Test your understanding - Static: Attempt review
Question 3
Correct
For the below code, what are the valid ways to invoke display method in the main method.
Test.display();
Static method can be invoked either by using the object instance or using the class name.
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120709&cmid=5204 5/7
2/19/24, 8:03 PM Test your understanding - Static: Attempt review
Question 4
Correct
int flightId;
44953
Non static members cannot be accessed from static methods. If we want to access non static members from a static method it is
possible by creating an object. Hence, only "noOfSeats" can be accessed, not "flightId".
int flightId;
44953
[System.out.println("No of seats "+noOfSeats);]
Question 5
Correct
static method
Can access static members only
Jump to...
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120709&cmid=5204 6/7
2/19/24, 8:03 PM Test your understanding - Static: Attempt review
44953
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120709&cmid=5204 7/7
2/19/24, 8:03 PM Test Your understanding - Constructor: Attempt review
Dashboard / My courses / Java / Class and Objects, Date API / Test Your understanding - Constructor
Quiz review
Started on Sunday, 28 January 2024, 6:46 PM
State Finished
Completed on Sunday, 28 January 2024, 6:47 PM
Time taken 1 min 17 secs
Marks 4.00/5.00
Grade 80.00 out of 100.00
Feedback Congratulations!!! You have passed by securing more than 80%
44953
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120665&cmid=5203 1/7
2/19/24, 8:03 PM Test Your understanding - Constructor: Attempt review
Question 1
Correct
//Constructor 1
public Student() {
id=0;
44953
}
//Constructor 2
this.id=id;
this.name=name;
Choose the constructor that is invoked, when an object is created as shown below.
//Constructor 1
public Student() {
id=0;
//Constructor 2
this.id=id;
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120665&cmid=5203 2/7
2/19/24, 8:03 PM Test Your understanding - Constructor: Attempt review
this.name=name;
Choose the constructor that is invoked, when an object is created as shown below.
Question 2
Incorrect
44953
You are given with few classes.
Match the code with the type of constructor available in the class.
public Student {
} Parameterized Constructor
} 44953
public Student(int studentId, String name) {
Default constructor
} No-argument Constructor
}
{
44953
} → No-argument Constructor, public class Student {
public Student(int studentId, String name) {
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120665&cmid=5203 3/7
2/19/24, 8:03 PM Test Your understanding - Constructor: Attempt review
Question 3
Correct
int studentId;
String name;
char grade;
this.studentId = studentId;
this.name=name;
calculateGrade(mark);
44953
public void calculateGrade(float mark){
if(mark>90)
grade='A';
else
grade='B';
Select one:
Compiles successfully
Compilation error because of the parameter – mark - in constructor. It should be grade instead of mark.
44953
Your answer is correct.
The correct answer is: Compiles successfully
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120665&cmid=5203 4/7
2/19/24, 8:03 PM Test Your understanding - Constructor: Attempt review
Question 4
Correct
class Product{
int productId;
String productName;
Product {
productId=0; productName=” ”;
productId=id;
44953
productName=name;
Identify the valid option which is used to invoke the no argument constructor, Product(), at Line 1.
Select one:
Product
super();
Product();
this();
44953
this() invokes the current object's no argument constructor.
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120665&cmid=5203 5/7
2/19/24, 8:03 PM Test Your understanding - Constructor: Attempt review
Question 5
Correct
choose the code so that the constructor for Student class is overloaded correctly.
this.studentId=studentId;this.name=name;
this(studentId,name);
44953
this.grade=grade;
44953
Your answer is correct.
choose the code so that the constructor for Student class is overloaded correctly.
44953
public Student(int studentId, String name) {
[this.studentId=studentId;this.name=name;]
[this(studentId,name);]
[this.grade=grade;]
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120665&cmid=5203 6/7
2/19/24, 8:03 PM Test Your understanding - Constructor: Attempt review
Jump to...
44953
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120665&cmid=5203 7/7
2/19/24, 8:03 PM Test Your understanding - Classes and Objects: Attempt review
Dashboard / My courses / Java / Class and Objects, Date API / Test Your understanding - Classes and Objects
Quiz review
Started on Sunday, 28 January 2024, 6:38 PM
State Finished
Completed on Sunday, 28 January 2024, 6:41 PM
Time taken 2 mins 56 secs
Marks 7.67/8.00
Grade 95.83 out of 100.00
Feedback Congratulations!!! You have passed by securing more than 80%
Question 1
Correct
44953
___ and _____ are the access specifiers that can be applied to top level Class.
b. protected
c. public
d. default
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120518&cmid=5202 1/8
2/19/24, 8:03 PM Test Your understanding - Classes and Objects: Attempt review
Question 2
Correct
class Sample{
return a*a;
}
}
System.out.println(obj.num);
System.out.println(obj.square(10));
}
}
44953
Select one:
a. 100
Choose the appropriate access specifier for the attribute value so that it can be accessed from anywhere.
class Test
class Test
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120518&cmid=5202 2/8
2/19/24, 8:03 PM Test Your understanding - Classes and Objects: Attempt review
Question 4
Correct
Choose the appropriate return type for the getters and setters provided below.
class Test
44953
Choose the appropriate return type for the getters and setters provided below.
class Test
{
private int value;
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120518&cmid=5202 3/8
2/19/24, 8:03 PM Test Your understanding - Classes and Objects: Attempt review
Question 5
Correct
class Student
class Test
s.studentId=123;
}
44953
System.out.println(s.studentId);
Select one:
Compile time error
Any value
44953
0
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120518&cmid=5202 4/8
2/19/24, 8:03 PM Test Your understanding - Classes and Objects: Attempt review
Question 6
Partially correct
Analyze the below program, and fill the correct code so that it produces the below output:
101
class Book {
return bookId;
44953
this.bookId = bookId;
return bookPrice;
this.bookPrice = bookPrice;
bobj.setBookId(101);
System.out.println(bobj.getBookId());
Note : Same option can be used multiple times. Analyse and use the correct option
44953
Your answer is partially correct.
Analyze the below program, and fill the correct code so that it produces the below output:
101
class Book {
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120518&cmid=5202 5/8
2/19/24, 8:03 PM Test Your understanding - Classes and Objects: Attempt review
return bookId;
this.bookId = bookId;
this.bookPrice = bookPrice;
44953
Book bobj=new Book();
[System.out.println(bobj.getBookId());]
[bobj.setBookId(101);]
[System.out.println(bobj.getBookId());]
Note : Same option can be used multiple times. Analyse and use the correct option
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120518&cmid=5202 6/8
2/19/24, 8:03 PM Test Your understanding - Classes and Objects: Attempt review
Question 7
Correct
System.out.println("BookId:"+bobj.getId());
return bookId;
this.bookId = bookId;
}
44953
public double getBookPrice() {
return bookPrice;
this.bookPrice = bookPrice;
44953
public static void main(String[] args) {
bobj.setBookId(123);
bobj.setBookPrice(500);
System.out.println("BookId:"+bobj.getId());
System.out.println("BookPrice:"+bobj.getBookPrice());
44953
Analyze the above code and select the correct reason for the error.
Select one:
bobj is not initialized
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120518&cmid=5202 7/8
2/19/24, 8:03 PM Test Your understanding - Classes and Objects: Attempt review
The correct answer is: getId method is not present in the book class
Question 8
Correct
if(salary>0){
salary=salary1;
}
} 44953
}
if(salary>0){
salary=salary1;
}
44953
Jump to...
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120518&cmid=5202 8/8
2/19/24, 8:02 PM Pre-Quiz - Classes and Objects, Packages: Attempt review
Dashboard / My courses / Java / Class and Objects, Date API / Pre-Quiz - Classes and Objects, Packages
Quiz review
Started on Sunday, 28 January 2024, 6:36 PM
State Finished
Completed on Sunday, 28 January 2024, 6:37 PM
Time taken 1 min 13 secs
Marks 5.00/5.00
Grade 100.00 out of 100.00
Feedback Congratulations!! You have passed by securing more than 80%
Question 1
Correct
Select one:
True
False
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120478&cmid=5181 1/4
2/19/24, 8:02 PM Pre-Quiz - Classes and Objects, Packages: Attempt review
Question 2
Correct
{
int a = 2, b = 0;
continue;
else if (b == 10)
44953
break;
else
}
}
Select one:
a.
1 3 5 7 9 11 13 15 17 19
b.
2 4 6 8 12 14 16 18
d.
44953
13579
Question 3
44953
Correct
In Eclipse IDE, if we provide a workspace, it should already exist. If not, it will not open.
Select one:
True
False
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120478&cmid=5181 2/4
2/19/24, 8:02 PM Pre-Quiz - Classes and Objects, Packages: Attempt review
Question 4
Correct
int i=20;
if(i>10)
i++;
if(i%2!=0)
break;
b.
The value of i is 20
d.
The value of i is 10
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120478&cmid=5181 3/4
2/19/24, 8:02 PM Pre-Quiz - Classes and Objects, Packages: Attempt review
Question 5
Correct
switch(a)
default:
System.out.println("Welcome");
}
Of which data types can the variable ‘a’ be?
1. long
2. byte
3. int
4. char
44953
5. float
6. short
Select one:
a.
2,3, 4 and 6
b.
1 and 3
c.
3 and 4
d. 3, 4 and 5
Jump to...
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120478&cmid=5181 4/4
2/19/24, 8:02 PM Post-Quiz - Eclipse IDE: Attempt review
Dashboard / My courses / Java / Eclipse IDE / Post-Quiz - Eclipse IDE
Quiz review
Started on Sunday, 28 January 2024, 6:34 PM
State Finished
Completed on Sunday, 28 January 2024, 6:35 PM
Time taken 1 min 1 sec
Marks 4.00/4.00
Grade 100.00 out of 100.00
Feedback Congratulations!! You have passed by securing more than 80%
Question 1
Correct
44953
We can move an already existing project in eclipse to another location by compressing it. This we call as ________ the project.
Select one:
a. Exporting
b. Importing
Question 2
44953
Correct
Select one:
a. True
b. False
Question 3
44953
Correct
Select one:
a. CDT
b. JavaPlugin
c. JDT
d. PyDev
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120453&cmid=5179 1/2
2/19/24, 8:02 PM Post-Quiz - Eclipse IDE: Attempt review
Question 4
Correct
A project developed on one machine can be included in the current workspace by ___________ that project.
Select one:
a. Importing
b. Exporting
Jump to...
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120453&cmid=5179 2/2
2/19/24, 8:02 PM Pre-Quiz - Eclipse IDE: Attempt review
Dashboard / My courses / Java / Eclipse IDE / Pre-Quiz - Eclipse IDE
Quiz review
Started on Sunday, 28 January 2024, 6:30 PM
State Finished
Completed on Sunday, 28 January 2024, 6:32 PM
Time taken 2 mins
Marks 7.00/8.00
Grade 87.50 out of 100.00
Feedback Congratulations!! You have passed by securing more than 80%
Question 1
Correct
Select one:
True
False
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120381&cmid=5175 1/5
2/19/24, 8:02 PM Pre-Quiz - Eclipse IDE: Attempt review
Question 2
Correct
Which of the following options remain true for case constants in a switch construct?
Select one:
a.
The code with the switch construct gives a compilation error when there is a duplicate case label
b.
If no case matches and there is no default label, then it will result in a compilation error
c.
If no case matches and there is no default label, then no further action is taken and the switch statement completes abnormally
d.
If no case matches but there is a default label, then all statements after the matching default label in the switch block are
44953
executed in sequence.
e. If any one of the case constants has a match with the expression, then all statements after the matching case label in the switch
block are executed in sequence
Question 3
Correct 44953
Mark 1.00 out of 1.00
Select one:
a.
J2ME
b.
J2EE
c.
J2SE 44953
d. All these options
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120381&cmid=5175 2/5
2/19/24, 8:02 PM Pre-Quiz - Eclipse IDE: Attempt review
Question 4
Correct
int a=0;
if(a)
System.out.println( "Hello");
else
System.out.println( "Hai");
Select one:
a.
Hello
b. Compilation Fails
44953
c. Need to include the braces { } for the code to work
d.
Hai
Question 5
44953
Incorrect
__________ generates the byte code for a given file with .java extension.
Select one:
a.
JVM
b.
JDK
c. JRE
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120381&cmid=5175 3/5
2/19/24, 8:02 PM Pre-Quiz - Eclipse IDE: Attempt review
Question 6
Correct
{
int i = 10;
do while ( i < 10 )
while ( i > 10 ) ;
44953
}
Select one:
a. The value of i is 10
c. Compilation error
d. No output is produced.
Question 7
Correct
b.
JVM
c.
JDK
d. OS
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120381&cmid=5175 4/5
2/19/24, 8:02 PM Pre-Quiz - Eclipse IDE: Attempt review
Question 8
Correct
For compiling a java code we have separate compilers for different OS.
Select one:
True
False
44953
◄ Post-Quiz - Introduction to Java
Jump to...
Eclipse IDE ►
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120381&cmid=5175 5/5
2/19/24, 8:01 PM Post-Quiz - Introduction to Java: Attempt review
Dashboard / My courses / Java / Introduction To Java / Post-Quiz - Introduction to Java
Quiz review
Started on Sunday, 28 January 2024, 6:24 PM
State Finished
Completed on Sunday, 28 January 2024, 6:27 PM
Time taken 2 mins 52 secs
Marks 9.00/9.00
Grade 100.00 out of 100.00
Feedback Congratulations!! You have passed by securing more than 80%
Question 1
Correct
44953
In a for loop, if the number of statements are greater than one, which of the following needs to be inserted at the beginning and the end
of the loop?
Select one:
a.
French curly braces{ }
b.
Parenthesis
c.
Square bracket [ ]
44953
d. Arrows<>
Question 2
Correct
44953
JRE comprises of ___________ and ___________.
b. API
c. JVM
d. JDK
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120285&cmid=5173 1/5
2/19/24, 8:01 PM Post-Quiz - Introduction to Java: Attempt review
Question 3
Correct
The ________________ statement causes the program execution to stop and JVM to shut down.
Select one:
a.
exit
b.
System.exit
c. break
d.
return
Question 4
Correct
Select one:
a.
44953
Direct Access to memory using pointers
b.
Multi threading
c. Less security
d.
Exception Handling
44953
The correct answers are: Exception Handling, Multi threading
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120285&cmid=5173 2/5
2/19/24, 8:01 PM Post-Quiz - Introduction to Java: Attempt review
Question 5
Correct
Select one:
a. return int
b. be public static
c.
take boolean[] as argument
d. be private static
44953
The correct answer is: be public static
Question 6
Correct
Select one:
a. the next iteration of the loop
44953
b. the statement just after continue
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120285&cmid=5173 3/5
2/19/24, 8:01 PM Post-Quiz - Introduction to Java: Attempt review
Question 7
Correct
Select one:
a. do while
b.
for
c.
while
d.
if
Select one:
44953
a. Desktop Application
b. Web Application
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120285&cmid=5173 4/5
2/19/24, 8:01 PM Post-Quiz - Introduction to Java: Attempt review
Question 9
Correct
switch (c) {
44953
case a-1: System.out.print("a-1 ");
break;
Select one:
a.
44953
a-2 a-1 a default default
b.
a-2 a-1 a default a-1
c.
a-2 a-1 a default a-1 default a-1
d. a default a-1
44953
◄ Ludo King
Jump to...
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120285&cmid=5173 5/5
2/19/24, 8:01 PM Test Your Understanding - Introduction to Java: Attempt review
Dashboard / My courses / Java / Introduction To Java / Test Your Understanding - Introduction to Java
Quiz review
Started on Monday, 29 January 2024, 5:54 AM
State Finished
Completed on Monday, 29 January 2024, 5:59 AM
Time taken 5 mins 7 secs
Marks 11.00/11.00
Grade 100.00 out of 100.00
Feedback Congratulations!!! You have passed by securing more than 80%
Question 1
Correct
44953
What value is stored in i at the end of this loop?
for(int i =1;i<=10;i++)
Select one:
a. 11
b. 9
c. 10
d. 1
44953
The program control will exit the for loop only when the condition specified in the for loop has failed. Hence, the value of i will be 11.
The correct answer is: 11
Question 2
Correct
44953
French curly braces { } is a must if the for loop executes more than one statement. State true or false.
Select one:
True
False
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1127854&cmid=5151 1/7
2/19/24, 8:01 PM Test Your Understanding - Introduction to Java: Attempt review
Question 3
Correct
12. do {
13. y--;
14. ++x;
Select one:
a. 5,5
44953
b. 6,5
c. 5,6
d. 6,6
The iteration stops when x equals 5. At this stage y also would have reached the value 5. Hence the output 5 5.
The correct answer is: 5,5
44953
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1127854&cmid=5151 2/7
2/19/24, 8:01 PM Test Your Understanding - Introduction to Java: Attempt review
Question 4
Correct
class selection_statements {
int var1 = 5;
int var2 = 6;
if ((var2 = 1) == var1)
System.out.print(var2);
else
System.out.print(++var2);
44953
}
Select one:
a. 1
b. 4
c. 3
d. 2
44953
Observe the if construct. var 2 is assigned 1. 1 does not equal 5, hence else block will get executed. Pre increment to var2 results in 2
(var2 variable now has the value 1, not 6). Hence 2 gets printed.
Question 5
Correct
for
44953
looping structure should be used when the iterations are known.
[for] looping structure should be used when the iterations are known.
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1127854&cmid=5151 3/7
2/19/24, 8:01 PM Test Your Understanding - Introduction to Java: Attempt review
Question 6
Correct
1. class Crivitch {
2. public static void main(String [] args) {
3. int x = 10;
4.
5. do { } while (x++ < y);
6. System.out.println(x);
7. }
8. }
Select one:
a. int y=13;
44953
b. int y=11;
c. int y=10;
d. int y=12;
44953
Question 7
Correct
Which of the following loops will execute the body of loop even when condition controlling the loop is initially false?
Select one:
a. while
b. do-while
c. for
44953
Your answer is correct.
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1127854&cmid=5151 4/7
2/19/24, 8:01 PM Test Your Understanding - Introduction to Java: Attempt review
Question 8
Correct
Select one:
a. done 44953
b. one two three done
44953
Execution of Case 1 is followed by 2 and 3 since there's no break statement encountered. So, one two three.
Execution of Case 2 is followed 3 since there's no break statement encountered like before. So, two three.
The correct answer is: one two three two three done
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1127854&cmid=5151 5/7
2/19/24, 8:01 PM Test Your Understanding - Introduction to Java: Attempt review
Question 9
Correct
Select one:
a. j = 1
44953
b. j = -1
c. j = 0
d. Compilation fails.
One can not specify multiple case labels with commas, as in line 4. Hence compilation error.
The correct answer is: Compilation fails.
Question 10
Correct
44953
The break statement causes an exit ___________
b.
from the innermost switch.
44953
c. from the innermost loop
d.
from the program.
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1127854&cmid=5151 6/7
2/19/24, 8:01 PM Test Your Understanding - Introduction to Java: Attempt review
Question 11
Correct
switch( byte )
{
.......................................
default:
System.out.println("Hello");
44953
Switch in java works with primitive data types byte, short, char and int;
wrapper classes like Character, Byte, Short and Integer;
enumerated types (added in java 5) and String class (added in java 7)
switch([byte])
{
44953
case value2 : ..........................
.......................................
default:
System.out.println("Hello");
}
◄ Control Structures
44953
Jump to...
SampleCode_HelloWorld ►
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1127854&cmid=5151 7/7
2/19/24, 8:01 PM Pre-Quiz - Introduction to Java: Attempt review
Dashboard / My courses / Java / Introduction To Java / Pre-Quiz - Introduction to Java
Quiz review
Started on Sunday, 28 January 2024, 6:19 PM
State Finished
Completed on Sunday, 28 January 2024, 6:20 PM
Time taken 37 secs
Marks 7.00/7.00
Grade 100.00 out of 100.00
Feedback Congratulations!! You have secured more than 80%
Question 1
Correct
44953
To compile, debug and execute a program written in java, _______________ is required.
Select one:
a.
JDK
b. JIT
c.
JRE
d.
JVM
Select one:
a. James Gosling
b. Dennis Ritchie
44953
c.
Donald Knuth
d. Jim Gray
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120202&cmid=5139 1/3
2/19/24, 8:01 PM Pre-Quiz - Introduction to Java: Attempt review
Question 3
Correct
Select one:
a. GreenTalk
b. Algol
c. COBOL
d. The Oak
Question 4
Correct
44953
Mark 1.00 out of 1.00
JVM is independent of OS
Select one:
True
False
What is Polymorphism?
Select one:
a. blueprint for an object
d.
ability to acquire the properties
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120202&cmid=5139 2/3
2/19/24, 8:01 PM Pre-Quiz - Introduction to Java: Attempt review
Question 6
Correct
Select one:
True
False
Question 7
Correct
44953
Mark 1.00 out of 1.00
Java is _____________________________.
Select one:
a. Platform independent
b. Platform dependent
44953
Jump to...
44953
https://accenturelearning.tekstac.com/mod/quiz/review.php?attempt=1120202&cmid=5139 3/3