Skip to main content

Posts

Practice Set: Unit-4

                                                                                                                Practice Set: Unit 4 1. What are the uses of super keyword in Java? Explain with a suitable example. 2. What are the various uses of final keyword in java? An abstract method can not be declared final. Why? 3. Differentiate between Abstract class and Interface. What do you mean by Functional interface and Lambda Expression?  ...

ETE Practice Set-1

                                                                 Mock Test-1 -----------------------------------------------------------------------------------------------------------------------------   1 (a) Write a program that reads 10 integers between 1 and 100 and counts the occurrences of each. Assume the input ends with 0.                                                         ...

Practice Set

1. Write a program to create a class Voter which contains attributes name, date_of_birth and voter_id and voter has a Voter_Card. Provide appropriate constructor to initialize all the attributes of the Voter but voter id must be assigned automatically only when the age of the voter is greater than or equal to 18 years. VoterCard is a nested class with attributes voter_id and Voter_name. Make sure that voter card is created only when user is a valid voter and if it is already created then must not be assigned the new voter id. 2. Write a program to define two interfaces UGC and AICTE both having a default method int getAdmission() to take the admission and an abstract method String payFee(). getAdmission() in UGC must ask the percentage in qualifying exam and if the percentage >= 60 then generate the registration number and return. getAdmission() is AICTE must ask the user to join the counseling after 5 days and display the date of counseling and return the counseling token numb...
What will be the output?  1. class DemoString   {    public static void main(String... rk )              {           StringBuilder b = new StringBuilder (" abcdef ");           b.delete (4,6);           b.ensureCapacity (22);           System.out.print ( b.capacity ());             b.ensureCapacity (23);           System.out.print ( b.capacity ());     } } 2.      import java.time.*; import java.time.format.*; class DemoDateTime {    public static void main(String...rk)     {          Dat...

Practice Set 2

1. Write an application for Mobile Store where the user can view the available mobile phones in the store according to his/her preference. Store the mobile phone objects having attributes model number, OS, and Price. User should be allowed to filter the phones on the basis of those features. If user selects the model number, then ask to enter the model number and then display all the details of the phone with the given model number. If user selects OD then ask to choose the OS( Android/Windows/IOS) and display all the mobiles with that OS. If the user selects Price then ask to enter the minimum and maximum amount and display all the mobiles which can be bought with that amount. Now ask the user to select the mobile and display the details and bill. 2. Write an application for Cellular Company which provides different post paid plans for Calling/SMS. Ask the user to select the service provider and Display the menu to select the plan/pay bill. If user wants to selec...

Compile-time Binding and Run-time Binding (Static & Dynamic Binding)

Consider the following program: class Parent {    public void demo(double d)     {         System.out.println("Parent "+d);     }    public void test(double d)     {         System.out.println("Parent Test "+d);     } } class Child extends Parent {    public void demo(int d)     {         System.out.println("Child "+d);     }    public void test(double d)     {         System.out.println("Overriding test in Child "+d);     } } class CompileTimeBinding {    public static void main(String...rk)     {         Parent p = new Child();         p.demo(5);   //Compile time Binding         p.t...

Brainstorming

What will be the output of the following Programs? A. class If_Demo {   public static void main(String...rk){    int i =10;    if(true)     {         i=20;     }    else        System.out.print(i);    System.out.println(++i);   } } B. class WhileDemo {   public static void main(String...rk){    int i =10;    while(false)     {         i=20;     }     System.out.println(++i);   } }