Quiz-summary
0 of 14 questions completed
Questions:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
Information
This quiz will try to cover the following objectives:
- Declare and initialize variables.
- Differentiate between object reference variables and primitive variables.
- Read or write to object fields.
- Explain an object’s lifecycle.
- Call methods on objects.
- Manipulate data using the StringBuilder class and its methods.
- Create and manipulate strings.
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading...
You must sign in or sign up to start the quiz.
You have to finish following quiz, to start this quiz:
Results
0 of 14 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0)
Categories
- Not categorized 0%
-
By pressing the “View Questions” you can easily review your answers and find additional explanations.
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- Answered
- Review
-
Question 1 of 14
1. Question
Select all statements that are not true:
Correct
Incorrect
-
Question 2 of 14
2. Question
Select which of the following statements are true:
Correct
Incorrect
-
Question 3 of 14
3. Question
Given the following the code:
/*1*/ public class MainClass { /*2*/ public static void main(String[] args) { /*3*/ char var1 = 's'; /*4*/ char var2 = 44; /*5*/ char var3 = '1'; /*6*/ int var4 = 1000; /*7*/ System.out.println(var1++); /*8*/ } /*9*/ }
What statement is true ?
Correct
Incorrect
-
Question 4 of 14
4. Question
Given the following code:
/*1*/ public class MainClass { /*2*/ public static void main(String[] args) { /*3*/ char var1 = 's'; /*4*/ char var2 = -44; /*5*/ char var3 = '1'; /*6*/ int var4 = 1000; /*7*/ System.out.println(++var1 + ":" + var3); /*8*/ } /*9*/ }
What statement is true ?
Correct
Incorrect
-
Question 5 of 14
5. Question
What is the output of the following code:
public class MainClass { public static void main(String[] args) { int x = 1; long y = 2; short z = 3; System.out.println(++x + y++ * z); } }
Correct
Incorrect
-
Question 6 of 14
6. Question
Which of the following options contain correct code to declare and initialize variables to store whole numbers?
Correct
Incorrect
-
Question 7 of 14
7. Question
Select the options that, when inserted at // INSERT CODE HERE, will make the following code output a value of 3:
public class MainClass { static int a = 12; public static void main(String[] args) { // INSERT CODE HERE System.out.println(a++ % 5); } }
Correct
Incorrect
-
Question 8 of 14
8. Question
What is the output of the following code:
public class MainClass { public static void main(String[] args) { int a=1; int b=++a + 2; int c=a++ + 3; int d = a * c + b * c % 3; System.out.println(d); } }
Correct
Incorrect
-
Question 9 of 14
9. Question
Give the following code:
public class MainClass { public static void main(String[] args) { boolean a = 1; int b = 1; System.out.println(a == b); } }
What statement is true ?
Correct
Incorrect
-
Question 10 of 14
10. Question
Examine the following code and select the correct options:
/*1*/ public class MainClass { /*2*/ public static void main(String[] args) { /*3*/ int int1 = 12; /*4*/ double double1 = 17.8f; /*5*/ boolean bool1 = true; /*6*/ boolean returnVal = (int1 > double1) & bool1; /*7*/ System.out.println(returnVal); /*8*/ } /*9*/ }
Correct
Incorrect
-
Question 11 of 14
11. Question
Given the following code:
public class MainClass { static int i = 0; public static void main(String [] args) { MainClass obj = new MainClass(); ++i; obj.i++; ++obj.i; i+=1; System.out.println(obj.i + " " + MainClass.i); } }
What is the output ?
Correct
Incorrect
-
Question 12 of 14
12. Question
Given the following code:
package mainpack; public class MainClass { static int i = 0; public static void main(String [] args) { boolean log3 = ( 5.0 != 6.0) && ( 4 != 5); boolean log4 = (4 != 4) || (4 == 4); System.out.println("log3:"+ log3 + " log4:" + log4); } }
What is the output ?
Correct
Incorrect
-
Question 13 of 14
13. Question
What will happen when you compile and run the following code?
public class MainClass { int CONST = 100; public static void method() { System.out.println(CONST); } public static void main(String argv[]) { int CONST = 200; MainClass s = new MainClass(); s.method(); } }
Correct
Incorrect
-
Question 14 of 14
14. Question
Given the following declaration:
public class MainClass { static int CONST = 100; public static void main(String argv[]){ MainClass mc = new MainClass(); // INSERT CODE HERE } }
Which of the following statements are correct if they replace the comment line?
Correct
Incorrect