QUESTION 12 In the following program segment, match to following with the most a
ID: 3717214 • Letter: Q
Question
QUESTION 12 In the following program segment, match to following with the most applicable definition: public class Student f private int studentNumber public Student0 () public Student int no) (studentNumber no; ne 4 public int GetStudentNumber0 return studentNumber Mine 5 public void SetStudentNumber(int no) Wline 1 Mine 2 Mine 3 line 6 Mine 7 Mine 8 A. studentNumber in line 2 Student) in line 3 Student(int no) in line 4 8 Data memb D. Mutator SetStudentNumberint no) in line 6 QUESTION 14 switch (phoneDigit) case 1: num1; case 2: num 2 case 3: num 3; case 4: num=4; default num 0 Looking at the example above, what happens if the break is omitted? o a num is assigned 1 o b.num is never assigned a value O C.num is always assigned 0 o d.a syntax error is generated QUESTION 16 In the following code segment, match each with the most appropriate designation: public static void Maino Mine1 double roomWidth; ne2 Displaylnstructions0; mine 3 roomWidth GetDimensions0 ne 4 Room rt Mine 5 Mine 6 public in ine 1 keyword 8 in line 2 class n line 3 D. data type Main) in line 1 ' ri in line 5 Room in line 5 Room in line 6 ) in line 4Explanation / Answer
Question no 12:
StudentNumber in line 2 : data member
Student() in line 3: Constructor (It is a default Constructor without any arguments)
Student(int no) in line 4: Constructor (It is a parameterized Constructor with arguments)
int GetStudentNumber(): accessor(accessor methods are used to return some field values without modifying anything.Method name starts with Get like GetStudentNumber)
Void SetStudentNumber(int no): Mutator (Mutator methods are used to set some field values.It do not have a return type.M method name starts with Set)
Question 14:
Value of num will always be zero
If the break is omitted in all the cases all lines will be executed after the matching case label.If phoneDigit is 1 ,num will be assigned 1 first then 2 then 3 then 4 and finally num will be assigned to zero. If phoneDigit is 2, num will be assigned 2 first then same process continues.Finally num will be zero.
Question 16:
public in line 1: keyword
double in line 2: datatype
DisplayInstructions in line 3: method
Main() in line 1: method
r1 in line5: object
Room in line 5: class
Room() in line 6: Constructor
getDimensions in line 4: method
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.