Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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)); -
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases With Application To GIS

Authors: Philippe Rigaux, Michel Scholl, Agnès Voisard

1st Edition

1558605886, 978-1558605886

More Books

Students also viewed these Databases questions

Question

Conduct a SWOT analysis and describe the four factors involved

Answered: 1 week ago