CSE 110 Midterm Exam Study Guide || Error-free Answers 100%.
What will be the output of this code?
int x = 2;
int y = 10;
x = y + 1;
y = x - 1;
x = x + 1;
y = y - 1;
x = x - y;
System.out.print(x); correct answers 3
What will be the output of this code?
int x = 13;
int y = 3;
int a = y;
y = x;
x = a;
System.out.print(x); correct answers 3
Given the following int (integer) variables -
a = 11
b = 37
c=3
, d=5
Evaluate the expression:
a + b % c * d correct answers 3
What characters cannot be used in java identifiers? correct answers - A valid identifier must have
characters [A-Z] or [a-z] or numbers [0-9], and underscore(_) or a dollar sign ($). for example,
@javatpoint is not a valid identifier because it contains a special character which is @.
- There should not be any space in an identifier. For example, java tpoint is an invalid identifier.
- An identifier should not contain a number at the starting. For example, 123javatpoint is an
invalid identifier.
- An identifier should be of length 4-15 letters only. However, there is no limit on its length. But,
it is good to follow the standard conventions.
- We can't use the Java reserved keywords as an identifier such as int, float, double, char, etc. For
example, int double is an invalid identifier in Java.
- An identifier should not be any query language keywords such as SELECT, FROM, COUNT,
DELETE, etc.
What are the Java primitive data types? correct answers Byte
Short
Int
Long
Float
Double
What will be the output of this code?
int x = 2;
int y = 10;
x = y + 1;
y = x - 1;
x = x + 1;
y = y - 1;
x = x - y;
System.out.print(x); correct answers 3
What will be the output of this code?
int x = 13;
int y = 3;
int a = y;
y = x;
x = a;
System.out.print(x); correct answers 3
Given the following int (integer) variables -
a = 11
b = 37
c=3
, d=5
Evaluate the expression:
a + b % c * d correct answers 3
What characters cannot be used in java identifiers? correct answers - A valid identifier must have
characters [A-Z] or [a-z] or numbers [0-9], and underscore(_) or a dollar sign ($). for example,
@javatpoint is not a valid identifier because it contains a special character which is @.
- There should not be any space in an identifier. For example, java tpoint is an invalid identifier.
- An identifier should not contain a number at the starting. For example, 123javatpoint is an
invalid identifier.
- An identifier should be of length 4-15 letters only. However, there is no limit on its length. But,
it is good to follow the standard conventions.
- We can't use the Java reserved keywords as an identifier such as int, float, double, char, etc. For
example, int double is an invalid identifier in Java.
- An identifier should not be any query language keywords such as SELECT, FROM, COUNT,
DELETE, etc.
What are the Java primitive data types? correct answers Byte
Short
Int
Long
Float
Double