Question: CS 1 0 7 3 Practice Q estions Question 1 : Determine the output public class Q 1 { public static char [ ] myMethod

CS1073 Practice Qestions
Question 1: Determine the output
public class Q1{
public static char[] myMethod(int [] data){
char [] result = new data. length];
for(int i=0;i data. length; i++
if data [i]%2==0
result [i]='Y';
}
else{
}
result [i]='N';
}
return result;
}
public static void main(String[] args){
int [] arrA={1,2,3};
char[]arrB=myMethod(arrA);
System.out.print (arrB[]+cdotscdots+arrB[1]+cdots+arrB[2]);
}
}
Question 2:
Given two class: ClassTwo is a subclass of ClassOne (ClassTwo extends ClassOne). Each class has the following method signatures:
ClassOne
public void methodA(double n, String s)
public double methodB(int x)
public String methodC(double y)
public String methodC(String s)
ClassTwo extends ClassOne
public double methodB(String x)
public String methodD(String s)
Determine which of the following statements are valid / invalid given two objects; myObjectOne of type ClassOne and myObjectTwo of type ClassTwo:
ClassOne myObjectOne = new ClassOne();
ClassTwo myObjectTwo = new ClassTwo();
a.) double answer = myObjectOne.methodC(3.75);
b.) myObjectTwo.methodA ,"2.0");
d.) System.out.printIn(myObjectOne.methodC(myObjectTwo.methodB(5)); -
 CS1073 Practice Qestions Question 1: Determine the output public class Q1{

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!