Programming Concepts using Java, Quiz 1
Consider the code given below. How many activation records are created while executing this code?
class ClassOne{ public void methodOne(){ // ... } public void methodTwo(){ // ... methodOne(); // ... } public void methodThree(){ // ... methodTwo(); // ... }}class ClassTwo{ public static void main(String[] args){ // ... ClassOne c = new ClassOne(); c.methodThree(); }}Consider the code given below. How many activation records are created while executing this code? class ClassOne{ public void methodOne(){ // ... } public void methodTwo(){ // ... methodOne(); // ... } public void methodThree(){ // ... methodTwo(); // ... } } class ClassTwo{ public static void main(String[] args){ // ... ClassOne c = new ClassOne(); c.methodThree(); } } Figure from the original question paper Consider the Java code given below. public class NumberEvaluation { public static void main(String[] args) { int number = 10; do { number--; } while (number > 5); switch (number) { case 5: System.out.println("Low"); break; case 6: System.out.println("Medium"); break; default: if (number > 6) { System.out.println("High"); } else { System.out.println("Unknown"); } break; } } } What will the output be?