Answered step by step
Verified Expert Solution
Question
1 Approved Answer
review all my answers with an explanation , Also I face a problem with solving recursion question so I need an easy way to solve
review all my answers with an explanation , Also I face a problem with solving recursion question so I need an easy way to solve them in exams
What does the following function print for n=12345 ? void fun(int n ) \{ if (n==0) return; System.out.println (n10); fun (n/10); \} Answer: 5 3 2 1 4. Suppose A is an abstract class, B is a concrete subclass of A, and both A and B have a default constructor. Which of the following is correct? 1.Aa=newA();2.Aa=newB();3.Bb=newA();4.Bb=newB(); a) 1 and 2 M251-MOCK-FINAL-Fall-2019-2020 Page 2 b) 1 and 3 c) 2 and 4 d) 3 and 4 1. What is the value of the following expression? 2+8/53 a) 6 b) 5 c) 2 d) 0.666666666667 e) none of the above Given the following class diagram, which of the following statements is valid (or correct)? For invalid (or incorrect) ones, explain the reason. 1. Person p= new Person( ) 2. Person p= new Passenger(); 3. There is a composition relationship between Flight and Passenger 4. Class Person should have at least one abstract method 5. Class Passenger is a subclass of class Person 6. The default value for an instance variable of type Flight is 0 Read the following questions and choose the best answer. 1. The Java displays the source code of the given bytecode files. a. interpreter b. compiler (c.)disassembler d. debugger e. document generator 2. Operations that modify original collection are called operations. a. destructive b. bulk c. accessor d. non-destructive e. none of the above 3. is the process of having 2 methods with same signature in super and sub classes but with different implementation. a. Shadowing b. Overloading c. Overriding d. Hiding e. none of the above 4. Math.sqrt() is a a. class variable b. class method c. instance variable d. instance method e. none of the above 5. In Java, a thread can be created by a. extending Thread class b. implementing Runnable interface c. implementing Comparable interface d. Both a and b e. Both a and c What does the following method return for s = "Tuesday"? (Show your working steps in details)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started