MCQ'S Answers:

1. He came - the 

2. She has - no article  

3. He is rich - no article  

4. Three - the,the  

5. Ramesh - no article  

6. Dinner - the 

7. I heard - the,the 

8. I will take - a,the 

9. He went USA - no article, the 

10. I will take - a,the

11. Ram was - no article  

12. When I went - no article, no article  

13. Suresh - no article  

14. Measles - the,a 

15. He died - no article  

16. I like - no article  

17. He organised - a,the 

18. Ram took - the,the,a 

19. He has already - no article  

20. He can speak - no article, no article



Program answers:


JAVA - File Handling - Count 1s(Id-5282)


import java.io.*;

import java.util.*;


public class Hello{

    public static void main(String[] args){

        Scanner scan=new Scanner(System.in);

        String fileName=scan.next();

        try{

            File file = new File(fileName);

            Scanner sc = new Scanner(file);

            int n,c=0;

            while(sc.nextInt()){

                n=sc.nextInt();

                if(n==1){

                    c+=1;

                }

            }

            System.out.print(c);

        }

        catch(Exception e){

            e.printStackTrace();

        }

    }

}






JAVA - Generics - String Sort(Id-5283)


import java.util.*;


public class Hello

{

    public static void main(String[] args) {

        Scanner scan=new Scanner(System.in);

        int N=scan.nextInt();

        List<String> strings = ArrayList<>(N);

        for(int ctr=1;ctr<=N;ctr++){

            strings.add(scan.next());

        }

        sortAndPrint(strings);

    }

    public static void sortAndPrint(List<String> string){

        Collections.sort(string);

        for(String i:string){

            System.out.println(i);

        }

    }

}