Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question Completion Status: QUESTION 1 Read the definitions given in the table below. Write the suitable terms matching to the descriptions in the empty space

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Question Completion Status: QUESTION 1 Read the definitions given in the table below. Write the suitable terms matching to the descriptions in the empty space provided. Answers can be used once or multiple times. A Java concept that is achieved by combining methods and A constructor attributes into a class. 8. encapsulation is called when an object is created. C. public Modifier that only allows access from the class that declares it. D.static Define a new class with attributes from existing class and extend with special attributes E. new keyword F. class Causes Java to execute a method. G. method-overloading Modifier that has no scope restriction. H. private Several methods with same name and different signature Used in a class instance creation expression to create an instance of a class. 1. method call Defined as a template that describe the behavior of all object of K. methods overriding certain kind Linheritance An object-oriented feature that promotes code reusability by allowing sub-class to modify methods inherited from superclass. Inheritance Cacao and Submit to see and submit. Click Save All Anto saw all QUESTION 2 What is the output of this program? public class Calculate public int doMath(int x, inty) { return (x-ya } public class CalculateApp { public static vold mainot int x = 5; int y = 20 Calculate cal = new Calculate x-cal.domathly.x): System.out.print("x"+X+"y"+y): y=cal.doMath(x,x); System.out.print("X-+ +*+"y"+y); X-15-20 y=15, y X=15, y-20 X-0. - 15 X=15, y=20 x 15-20 X-Gy15x-15.y= 20 Chich are and Submit Stoners to save all me QUESTION 3 public class ColorWheel { private int brightness: public ColorWheel () { setBrightness(6): } public Color Wheel (int c) { brightness = c } public ColorWheel (double d) { brightness = (int)d: ) public ColorWheel (int c int 2) { brightness = c+z: public void setBrightness(int bright) { brightness - bright:) public String toStringo return "The bright is" - brightness 1 public class colorApp public static void main() ColorWheel c1 - new ColorWheelo: ColorWheel 2 - new ColorWhee 2) System.out.print) Che Sound Sabit to save and submit Charme public ColorWheel (double d) { brightness = (int)d; } public ColorWheel (int c int z) { brightness = c+z:) public void setBrightness(int bright) {brightness - bright; } public String toStringo return "The bright is " + brightness; } 1 public class ColorApp{ public static void main() A ColorWheel ct - new ColorWheelo: ColorWheel c2 = new ColorWheel(2): System.out.print(c1) C1.setBrightness(3) 3 What is the output of this program? The bright is 2 The bright is 3 The bright is 6 The bright so Click Save and Submit to save and submit Chle Suures to see QUESTION 4 which is several methods with the same name and different parameters. Polymorphism supports Composition O Overloading O Generalization Association QUESTION 5 Which of the following is a CORRECT statement to declare a static method? O static public state(){} O public static void state public void state (static x) 0 O public void (0 QUESTION 6 A private member of a class is visible to O Everywhere O only by members in the same class O only by members in the same package O only in main program QUESTION 7 In OOP, private, static, final, protected and public are_ modifiers interfaces parameters O signatures QUESTION 8 QUESTION 8 Which of the following is a CORRECT statement? Scanner is a class that is used to get input from the user. O Scanner is a class that is used to create a variable. Scanner is a method which is used to create variable. Scanner is an object which is used to create variable. Click Save QUESTION 9 Which of the following keywords is used to prevent a variable from being modified O public O private final o abstract QUESTION 10 Which of these following can be overloaded? O Methods O Constructors a & b Interface Click Save and submit to save and submit. Click Save All Answers to s QUESTION 11 Which of the following best defines a class? O Scope of an object O Parent of an object O An example of an object Instance of an object Click Save and submit to save and submit Click Save An Ans QUESTION 12 Following is the syntax to create an object of class MyClass. Choose the CORRECT statement(s) related upon the statement's execution. MyClass obj = new MyClass(); Memory is allocated for new the object A new object of type MyClass is created O a &b None of the above. QUESTION 13 In order to ensure encapsulation in object-oriented programming we have to declare private instance variables and set public to all set and get methods declare final instance variables and set private to all methods O a 8.b define constructor with parameters QUESTION 14 A class diagram describes: O the practical modelling. O the architectural modelling. O the structural modelling the practical and the dynamic modelling. Click Save and Submit to save and steamt. Click Save ANA QUESTION 15 Given the following code segment. public class ColorWheel { private int brightness; public ColorWheel() { setBrightness(6); } public ColorWheel (int c) { brightness = c } public ColorWheel (double d) { brightness = (int)d; } public ColorWheel (int c, int z) { brightness = c+z; } public void setBrightness(int bright) (brightness = bright; } public String toStringo) { return "The color bright is..." + brightness: 3 public class ColorApp public class ColorApp{ public static void main() Color Wheel C1 = new ColorWheel(); ColorWheel C2 = new ColorWheel(4.5); ColorWheel c3 = new ColorWheel(2.3); System.out.print(c1); System.out.print(02); System.out.print(c4); } Which of the following type of constructer does object C1 construct upen execution? public ColorWheel () { setBrightness(6); public ColorWheel (int c) { brightness = c; } public ColorWheel (double d) { brightness = (int)d: ) Opublic ColorWheel (intc int z) brightness - C+z:: QUESTION 16 QUESTION 16 Given the following code segment. public class ColorWheel { public static int color: private int brightness: public ColorWheel () { setBrightness(6); } public ColorWheel (int c) { brightness = c } public ColorWheel (double d) { brightness = (int)d: public ColorWheel (int c. Int z) { int bri= 7: brightness - c+z setBrightness(bri); + public void setBrightness(int bright) frightness - bright:) public String toStringo return the bright is + brightness } } public class ColorApp{ public static void main(String [] args) { ColorWheel c1 = new ColorWheel(); ColorWheel C2 = new ColorWheel(2); ColorWheel c3 = new ColorWheel(4.5); ColorWheel C4 = new ColorWheel(2,3); System.out.print(c4); (4.setBrightness(3); } How many instance Variables does the code have? O 2 3 no Instance variable QUESTION 17 QUESTION 17 Complete the partial declaration of class Calculate as stated in the comment below. to receive input x and y values from user. (3 pt) VI (1) Call methods to assign the values received from the user. (1 pt) II (iv) display outputs on the screen as the sample. (1 pt) update code public class Calculate public int doMath(int x. int y) { return (x): 1 public class CalculateApp public static void main te se Calculate catenen calculated): 11 =A For the toolbar.press ALT+F10 (PC) or ALT-FN-F10 (Mac). RUS Aria an Daratan Com to zate and submit Club Sane Al Answer to wall

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

Deductive And Object Oriented Databases Second International Conference Dood 91 Munich Germany December 18 1991 Proceedings Lncs 566

Authors: Claude Delobel ,Michael Kifer ,Yoshifumi Masunaga

1st Edition

3540550151, 978-3540550150

More Books

Students also viewed these Databases questions