CS 1102 Programming Unit 3 Graded Quiz with Answers- 100% proven pass rate. Latest version 2022
CS 1102 Programming Unit 3 Graded Quiz with Answers- 100% proven pass rate. Latest version 2022 Document Content and Description Below In Java, a variable can only be used in a program if it has first been: - ☑☑Declared the do while loop repeats a set of code at least once before the condition is tested - ☑☑True The fol lowing definition of class Bank: public class Mortgage{ static double interestRate; interestRate=0.06; - ☑☑b)Will not compile The area of memory that objects reside in is known as the stack - ☑☑False In Java a variable can only be used in a program if it has first been - ☑☑a)Declared What is the output of the following code? public class Test{ public static void main (String[ ]args){ String s1 = new String ('Welcome to java"); String s2 = new String("Welcome to Java"); If (S1==S2) Sln("s1 and s2 reference to the same String object"); - ☑☑b)s1 and s2 reference to different String objects In Java, Gargbage Collection is the process that reclaims the memory used by objects which are no longer in use - ☑☑True What are formal parameters? - ☑☑a)Formal parameters are found in the subroutine definition, The values of the actual parameters are assigned to the formal parameters before the body of the subroutine is excused A computer is built to carry out instructions that are written in a type of language called binary language. - ☑☑True The for loop repeats a set of statements a certain number of times until a condition is matched - ☑☑True A memory location that has been given a name is called a: - ☑☑a)variable Examine the following class public class PatientRecord{ public String lastname; // Patients last name public int age;// Patients age on admission public boolean sex;// indicates if patient is male of female } initial values of lastname, age and sex instance variables will be: - ☑☑b)null, 0, false Which of the following is NOT a primitive data type - ☑☑d)String Consider the following code, which output is correct? Public class Student{ int age; static int age 2=3; public static void main (String [ ] args){ Student student1; Student student2; Student student3; student1= new Student ( ); =10; student2= student1; student3 = new Student( ); Sln(+ " "+ 2); } } - ☑☑a)10 3 The following code represents a syntactically valid switch statement? Int x; x
Document information
- Uploaded on
- May 9, 2023
- Number of pages
- 8
- Written in
- 2022/2023
- Type
- Exam (elaborations)
- Contains
- Questions & answers