Template For Assessments: Youtube
Template For Assessments: Youtube
Identify incorrect the java primitive type. There are ____ primitive data types are Identify the valid Boolean declaration.
there in java.
Recall/ Remembering Understanding Application
a) Byte a) 6 a) Boolean b1 = 1;
Ans: < Constants > Ans: <Keywords > Ans: < Instance Variable >
Assessment Type: Summative: End of LO: in LMS
Static variables are also As _____ are declared in public class TestMain Initializing a variable at int[ ] age={12,4,5,2,5};
known as _______. a class, these variables { run time is
are created when an static String msg = "Hello called_______. Identify the concept of
object of the class is World"; above declaration.
created and destroyed public static void
when the object is main(String[] args)
destroyed. {
System.out.println(msg);
}
}
Identify the concept of
above code.
a) garbage variable a) garbage variable a) Instance Variable a) type casting a) class declaration
b) Local Variable b) Local Variable b) Class Variable b) dynamic initialization b) String declaration
c) Instance Variable c) Instance Variable c) Local Variable c) type conversion c) initialize arrays
during declaration
d) Class variables d) Class variables d) garbage variable d) class declaration d) dynamic initialization
Ans: < Class variables> Ans: <Instance Variable > Ans: < Class Variable > Ans: < dynamic Ans: < initialize arrays
initialization > during declaration >
Summative: Q 6
We cannot perform dynamic initialization to the variables declared with ______ keyword.
Understand
a) Final
b) String
c) class
d) interface
B. List primitive data types with its size and default value.
Ans:
Data Type Default Value Default size
byte 0 1 byte
short 0 2 byte
int 0 4 byte
long 0L 8 byte
The declaration should be terminated by semicolon (;) whereas all the variable names of same datatype are separated
by commas;
Example:
There are three types of variables in java: local, instance and static.
1) Local Variable
A variable declared inside the body of the method is called local variable. You can use this variable only within that
method and the other methods in the class aren't even aware that the variable exists.
A local variable cannot be defined with "static" keyword.
2) Instance Variable
A variable declared inside the class but outside the body of the method, is called instance variable. It is not declared
as static.
It is called instance variable because its value is instance specific and is not shared among instances.