Professional Documents
Culture Documents
Learner Name
Programming – Grade 11
NQA Registration #
ATHS ID
1 2 3 4 5*
PC4.1 Identify the class as the formal implementation, or blueprint of different
objects (instances of a class) with defined attributes and behaviors ▢ ▢ ▢ ▢ x
1 2 3 4 5*
PC4.2 Describe the behaviour of a given code segment in a program based on
concepts of classes and objects and the relationship between them ▢ ▢ ▢ ▢ x
1 2 3 4 5*
PC4.6 Create objects by calling one of the class’s constructors with or without
parameters using the keyword new ▢ ▢ ▢ ▢ x
1 2 3 4 5*
PC4.7 Identify all constructors created within a class by having the same name
of the class and invoke them to create different objects ▢ ▢ ▢ ▢ x
1 2 3 4 5*
PC4.8 Utilize existing classes and class libraries as appropriate to create
objects within a program ▢ ▢ ▢ ▢ x
1 2 3 4 5*
PC4.9 Define the variables of the correct types to represent reference data of a
given problem ▢ ▢ ▢ ▢ x
1 2 3 4 5*
PC4.10 Identify the keyword null as a special value used to indicate that a
reference is not associated with any object ▢ ▢ ▢ ▢ x
PC4.11 Identify that the memory associated with a variable of a reference type 1 2 3 4 5*
holds an object reference value while the memory associated with a null
▢ ▢ ▢ ▢ x
object holds its address in the memory
PC5.1 Call non-static void methods without parameters correctly within a 1 2 3 4 5*
program
▢ ▢ ▢ ▢ ▢
1 2 3 4 5*
Identify procedural abstraction as a procedure that allows a
PC5.2
programmer to use a method by knowing what the method does even if
▢ ▢ ▢ ▢ ▢
they do not know how the method was written.
1 2 3 4 5*
PC5.3 Identify and write non-parameterized method with signature that
consists of the method name and an empty parameter list ▢ ▢ ▢ ▢ ▢
1 2 3 4 5*
PC5.4 Use the dot operator along with the object name to call non-static
methods through objects of the class ▢ ▢ ▢ ▢ ▢
1 2 3 4 5*
PC5.5 Demonstrate understanding of the fact that void methods do not have
return values and are therefore not called as part of an expression ▢ ▢ ▢ ▢ ▢
1 2 3 4 5*
PC5.6 Identify the causes of the NullPointerException error as using a null
reference to call a method or access an instance variable ▢ ▢ ▢ ▢ ▢
1 2 3 4 5*
PC5.7 Identify the parameterized method by its signature that consists of the
method name and a list of parameter types ▢ ▢ ▢ ▢ ▢
PC5.8 Identify and write non-static void methods with parameters correctly 1 2 3 4 5*
within a program considering the fact that the parameter list need to
correspond to the order and type in the method signature ▢ ▢ ▢ ▢ ▢
1 2 3 4 5*
PC5.9 Identify overloaded methods as the multiple methods with the same
name but a different signature ▢ ▢ ▢ ▢ ▢
Rubric
Performance
Score Description
Criteria
Student’s work is meeting the requirements of evidence quality against the
5
criteria identified in the unit of competency, by no less than 90%.
Student’s work is meeting the requirements of evidence quality against the
Achieved 4
criteria identified in the unit of competency, by no less than 80%.
Student’s work is meeting the requirements of evidence quality against the
3
criteria identified in the unit of competency, by no less than 70%.
NOT 2 Student’s work is approaching towards meeting the minimum requirements
Achieved of the evidence quality to demonstrate competency. Work quality must be
improved to be acceptable.
Student submits evidence that lacks quality towards demonstrating
1
competency against the criteria identified in the unit of competency.
0 No evidence of completion submitted.
Assessment writer
Learner’s declaration
I certify that the work submitted for this assignment is my own. I have clearly referenced any sources used in
the work. I understand that false declaration is a form of malpractice.
Assessor’s approval
Notes:
The instructor has the right to change or modify the assessment questions as long as he/she is
fulfilling the specification of the listed Performance Criteria.
If the instructor changes the questions, they have to be verified by an assessor.
When uploading the assessments to your ePortfolio, please follow the evidence naming
convention
Question1- Practical Assignment
2- Analyze the following java code and check which of the below statements will give syntax error
3- If you do not supply any constructors, the compiler will make a default constructor automatically.
Which of following is the correct characteristics of the default constructor?
A. It takes one parameter
It initializes all instance variables to their default values
B. It takes no parameters
It initializes all instance variables to their default values
C. It takes no parameters
It initializes all instance variables to "Zero"
D. It takes no parameters
It initializes all instance variables to "NULL"
5- Refer to the code segment below, how many constructers the programmer has used?
6- Create the Java class that is described below:
Create a Student class with data fields for a student number and a grade point average and 4
constructors as follows:
A constructor that accepts an int and a double and assigns them the student number and grade
point average, respectively
A constructor that accepts a double and assigns it to the grade point average, but initializes
every student number to 999
A constructor that accepts an int and assigns it to the student number, but initializes every
grade point average to 0.0
A default constructor that assigns 999 to every student number and 0.0 to every grade point
average
[This provides evidence for PC4.4, 4.6]
7- Create a Java program containing the following class:
S10 0 0.0
Create 10 Student objects by calling the proper constructor as described in the table shown above
2. A constructor that has no parameters that sets the instance variable as follows:
• mainIngredient="Chicken";
• bread="wheat";
• price=10.0;
Create an application named TestSandwich that instantiates four Sandwich objects as follows:
radius =0.0;
radius =r;
c. Instantiate a Circle object and assign its address to a Circle reference variable C2.
1- Label the statement that calls a non-parameters method with NP and the statement that calls method with
parameters with P.
Statement NP/P
s1.getName();
s1.setName(“Hamda”);
s1.printName();
s1.setID(“232”);
s1.getID();
E. Polymorphism
[This provides evidence for PC 5.2]
3- Which of the following method signatures is/are non-parameterized(NP) and which are parameterized (P)?
Method Signature NP/P
car1.calculateAcceleration(120,150);
_______________parameter list
_______________method name
_______________object name
[This provides evidence for PC 5.4]
5- Explain why the call statement written below by the object student1 to the method printInfo() is not correct.
6- When running the code segment below a NullPointerException error occurs. Explain why.
1 String name;
2 System.out.println(name.length());
7- Knowing that the method calculateBMI needs the height and weight to calculate the bmi value correctly.
Which is the correct method signature for the method calculateBMI?
A. public void calculateBMI()
B. public void calculateBMI(double height, double weight)
C. public void calculateBMI(double height)
D. public void calculateBMI(double weight)
8- Which of the following method call statements is/are correct when calling the method max by the object
number and which is NOT correct?
Method max signature: public void max(double n1,double n2, double n3)
9- Which of following should be the output after running the following program?
class MethodOverloading{
public static void main(String s[]){
print();
print(8);
int j = print(9);
}
public static void print(){
System.out.println("Called print with no parameters");
}
public static void print(int i){
System.out.println("Called print with int parameter with return type
void");
}
public static int print(int i){
System.out.println("Called print with int parameter with return type
int");
}
}
A.
Called print with no parameters
Called print with int parameter with return type void
Called print with int parameter with return type int
B. Compilation Error - since there are two methods with int parameter but return type is different.
C. Compilation Error - since there are three methods with the same name print.
D. Runtime Error - It fails with a runtime error, since it does not know which print method to call.
class Lease{
private String name;
private int aptNumber;
private double rent;
private int term;
private static final int FEE = 10;
public Lease(){
name = "XXX";
aptNumber = 0;
rent = 1000;
term = 12;
}
public void setName(String tenant) {
name = tenant;
}
public void setAptNumber(int apt){
aptNumber = apt;
}
public void setRent(double monthRent) {
rent = monthRent;
}
public void setTerm(int t){
term = t;
}
public String getName(){
return name;
}
public int getAptNumber(){
return aptNumber;
}
public double getRent(){
return rent;
}
public int getTerm(){
return term;
}
public void addPetFee(){
rent = rent + FEE;
}
}