Escolar Documentos
Profissional Documentos
Cultura Documentos
Answer all of the following questions, with justification for your answers. Send your answers in the form
of a word or PDF document to my email: amira.abdelaziz@fue.edu.eg maximum by Wednesday night.
Solution:
public Circle() {
radius = 1.0;
color = "red";
}
2- In the same manner, implement a class Rectangle following the next diagram:
Solution:
public class Rectangle {
private float length, width;
public Rectangle() {
length = 1.0f;
width = 1.0f;
}
1) if
2) then
3) goto
4) while
5) case
1) 2variable
2) variable2
3) _whatavariable
4) _3_
5) $anothervar
6) #myvar
Q3. If you run the code below, what gets printed out?
1) Bic
2) ic
3) icy
4) error: no method matching substring(int,char)
1) s3=s1 + s2;
2) s3=s1-s2;
3) s3=s1 & s2;
4) s3=s1 && s2
Q8. What will happen if you compile/run the following lines of code?
A) Prints 10.
B) Prints 15.
C) Compilation error, you can't change the length of an array.
D) Runtime exception at line 3.
Q9. If you compile and execute an application with the following code in its main() method:
byte myByte;
int myInt;
long myLong;
char myChar;
float myFloat;
double myDouble;
1) myInt = myByte;
2) myInt = myLong;
3) myByte = 3;
4) myInt = myChar;
5) myFloat = myDouble;
6) myFloat = 3;
7) myDouble = 3.0;