CCSE 1322 Final Test Study Guide. Questions and answers, graded A+// 2024/25 Exam PREDICTOR PAPER
CCSE 1322 Final Test Study Guide. Questions and answers, graded A+ What does the following code output? char letters[]=new char[5]; letters[0]='a'; letters[1]='b'; letters[2]='c'; letters[3]='d'; letters[4]='e'; String x="";for(int i=4;i>=2;i--) {x+=letters[i];}Sln(x); - -edc Arrays are not fixed length and can grow or shrink depending on if the size of the data set varies. - - false What does the following code output? int x=7; int y=10;i f((x>5) && (y>12)) {Sln("A"); } else if((x<7) || (y>10)) { Sln("B"); } else if((x<=14) && (y>2)) { Sln("C"); } else {Sln("D"); } - -C int x=10; for(int i=5;i<0;i--) { x++; } Sln(x); - -10 What is the maximum number of constructors a class can have? - -many class House { public int square_footage; public int stories; public House() { square_footage=0; stories=1;} public House(int sf, int s) { square_footage=sf;stories=s; } } - -House h1=new House(1500,1,1); How many parameters does a default constructor have? - -0 Constructor can return a value - -false class Stuff { public int number=1; } class Main { public static void main(String[] args) { Stuff myStuff = new Stuff(); mySr+=3; Sln("mySr:"+mySr); myStuff newStuff(); Sln("mySr:"+mySr); } } - -mySr:4 mySr:1 class Main { public static void swap(String str1, String str2) { String holdString; holdString = str1; str1 = str2; str2 = holdString; } public static void main(String[] args) { String s1 = "Computers"; String s2 = "Rock"; swap(s1, s2); Sln(s1+" "+s2); } } - -Computers Rock class Main { public static void addtwo(int[] numArray) { numArray[0]+=2; } public static void main(String[] args)
Written for
- Institution
- CCSE 1322
- Course
- CCSE 1322
Document information
- Uploaded on
- December 24, 2023
- Number of pages
- 52
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
ccse 1322 final test study guide questions and a