The quiz contains 15 questions and there is no time limit. You can get between 1 and 3 points for answering the questions correctly. At the end of the quiz, you'll receive a total score. You can compare yourself with other users via the leaderboard. If you achieve more than 70% you will be rewarded with a certificate. Good luck!
Test your understanding of the basics of Java programming language: - Data types and variables - Arithmetic operators - Relational operators - Logical operators - Bitoperators - Methods
Pos. | Name | Entered on | Points | Result |
---|---|---|---|---|
Table is loading | ||||
No data available | ||||
0 of 15 Questions completed
Questions:
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 must first complete the following:
0 of 15 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Average score |
|
Your score |
|
Pos. | Name | Entered on | Points | Result |
---|---|---|---|---|
Table is loading | ||||
No data available | ||||
What is the correct syntax to output My first Java program
?
How do you create a variable with a decimal value of 4.6
in Java?
(one or more answers)
Float and Double data types are used to store real or floating point numbers in Java, but a Double data type is more accurate than Float. Furthermore, double is the default data type for floating point numbers.
Select the appropriate data type for this value: true
What is the output for “result”?
class ArithmeticOperators {
public static void main(String[] args) {
int a = 5;
int b = 2;
int c = 5;
int result;
result = ++a + --c * b;
System.out.println(result);
}
}
What is the output for result?
class ArithmeticOperators {
public static void main(String[] args) {
int a = 5;
int b = 2;
int result;
result = --a * b++;
System.out.println(result);
}
}
Which operator can be used to decrement a value?
What is the output for result
?
class ArithmeticModulo {
public static void main(String[] args) {
int a = 20;
int b = 7;
int c = 4;
int result;
result = a % b % c;
System.out.println(result);
}
}
What is the output for result
?
class ArithmeticMixed {
public static void main(String[] args) {
int a = 10;
int b = 20;
int c = 5;
int result;
a = ++c;
b = ++c;
result = (a + b) % 2;
System.out.println(result);
}
}
Which operator can be used to check two values for equality?
What is the output for result
?
class RelLogOperators {
public static void main(String[] args) {
int x = 5;
int y = 6;
int z = 6;
boolean isSet = true;
if (x < y && y >= z) {
isSet = false;
}
System.out.println(isSet);
}
}
What is the output for result
?
class RelLogOperators {
public static void main(String[] args) {
int x = 3;
int y = 6;
int z = 4;
boolean isSet = false;
if (x < z && y >= z && x > z || isSet == false) {
isSet = true;
}
System.out.println(isSet);
}
}
What is the output for x
?
class BitwiseOR {
public static void main(String[] args) {
int x, y, a = 10, b = 14, c = 2;
x = a | b;
System.out.println(x);
}
}
| = bitwise OR
a = 10 = 1010
b = 14 = 1110
x = ?
What is the output for y
?
class BitwiseExclusiveOR {
public static void main(String[] args) {
int x, y, a = 10, b = 14, c = 2;
y = a ^ c;
System.out.println(y);
}
}
What is the output?
public class MethodRecursiveExample {
static void fun(int val) {
if (val == 20) {
return;
}
System.out.print(val);
fun(val + 2);
}
public static void main(String[] args) {
fun(10);
}
}
What is the output for result
?
public class Quiz {
public static int fun() {
return 2.5 + 10.8;
}
public static void main(String[] args) {
System.out.println(fun());
}
}
Cookie | Duration | Description |
---|---|---|
cookielawinfo-checkbox-advertisement | 1 year | Set by the GDPR Cookie Consent plugin, this cookie is used to record the user consent for the cookies in the "Advertisement" category . |
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
CookieLawInfoConsent | 1 year | Records the default button state of the corresponding category & the status of CCPA. It works only in coordination with the primary cookie. |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
Cookie | Duration | Description |
---|---|---|
_gat | 1 minute | This cookie is installed by Google Universal Analytics to restrain request rate and thus limit the collection of data on high traffic sites. |
Cookie | Duration | Description |
---|---|---|
_ga | 2 years | The _ga cookie, installed by Google Analytics, calculates visitor, session and campaign data and also keeps track of site usage for the site's analytics report. The cookie stores information anonymously and assigns a randomly generated number to recognize unique visitors. |
_gid | 1 day | Installed by Google Analytics, _gid cookie stores information on how visitors use a website, while also creating an analytics report of the website's performance. Some of the data that are collected include the number of visitors, their source, and the pages they visit anonymously. |
tk_lr | 1 year | The tk_lr is a referral cookie set by the JetPack plugin on sites using WooCommerce, which analyzes referrer behaviour for Jetpack. |
tk_or | 5 years | The tk_or is a referral cookie set by the JetPack plugin on sites using WooCommerce, which analyzes referrer behaviour for Jetpack. |
tk_r3d | 3 days | JetPack installs this cookie to collect internal metrics for user activity and in turn improve user experience. |
tk_tc | session | JetPack sets this cookie to record details on how user's use the website. |
Cookie | Duration | Description |
---|---|---|
m | 2 years | No description available. |