Computer Application - X Test - 7 Date: 07-Aug-2020 Total Marks - 100 Time - 2:00hours
This document contains instructions for a computer application test with 100 total marks across two sections. Section A is worth 40 marks and contains questions about for, while, and do-while loops, operators, output, and differences between call by value and reference. Section B is worth 60 marks and contains 4 programming questions including overloading a method, displaying patterns, sorting student data, searching arrays, merging arrays, and a class to convert between binary and decimal numbers.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
151 views3 pages
Computer Application - X Test - 7 Date: 07-Aug-2020 Total Marks - 100 Time - 2:00hours
This document contains instructions for a computer application test with 100 total marks across two sections. Section A is worth 40 marks and contains questions about for, while, and do-while loops, operators, output, and differences between call by value and reference. Section B is worth 60 marks and contains 4 programming questions including overloading a method, displaying patterns, sorting student data, searching arrays, merging arrays, and a class to convert between binary and decimal numbers.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3
Computer Application – X TEST -7 Date : 07-Aug-2020
Total Marks – 100 Time – 2:00Hours
SECTION A (40 Marks)
Attempt all questions
1. a) Explain the term „for‟ loop with example?
b) State one similarity and one difference between „while‟ and „do..while‟ loop? c) Rewrite by using „for‟ loop i) int p=5, sum=0; ii) int i=0; do { while(i<=20) sum=sum+p; { p++; }while(p<=100); System.out.println(i+‟ “); System.out.println(sum); i+=1 } d) What are the differences between „binary‟ and „ternary‟ operator? e) What will be the output: i) int m=2,n=15; ii) int i=2,k=1; for(int i=1;i<5;i++) while(++i<6) m++;--n; k*=I; System.out.println(“m=”+m); System.out.println(k); System.out.println(“n=”+n); 2. a) State a difference between call by value and call by reference.? b) What does you mean by this statement - COMP OBJ = new COMP(); ? c) What is an abstract class method? d) What is the difference between lvalue and rvalue ? e) What is the purpose of the keyword ‘this’? 3. a) Different between compareTo() and equals(). b) Complete the code given below to create an object of Scanner class: Scanner scanner = ___ Scanner(____); c) State the output of the following program segment: String Str =”Examination”; int n= Str.length(); System.out.println(Str.startsWith(Str.substring(5,n))); System.out.println(Str.charAt(2)== Str.charAt(6)); d) State method: (i) Convert a string to a primitive float data type. (ii) Determines if the specified character is an upper case character. e) State the output of the following program segment: String S = “Malayalam”; System.out.println(S.indexOf(„m‟); System.out.println(S.lastindexOf(„m‟); f) Write the output: (i) System.out.println(Character.isUpperCase(„R‟); (ii) System.out.println(Character.UpperCase(„r‟); g) Give output of the following code snippet i) String str = new String(“COMPUTER”); System.out.println(str.substring(3)); System.out.println(str.charAt(0)+10); ii) String s1 = "67420"; String s2 = "character"; System.out.print(s1.substring(2)); System.out.print(" CHA" + s2.substring(0,3).toUpperCase()); iii) String st = “PROGRAM”; System.out.println(st.indexOf(st.charAt(4))); iv) double A[ ]= {45,38,27,12,32,34,45}; for(int i=0;i<7;i+=2) if( A[i]%9==0) System.out.println(A[i]);
SECTION A (60 Marks)
Attempt any 4 questions (Comment lines and Variable Description must be written with the program) 4. Write program to overload a method name series() to the find Sum of given series : 1+2 1+2+3 1+2+3+4 1+2+3+⋯+𝑁 series(int N) : + + + ⋯+ 1∗2 1∗2∗3 1∗2∗3∗4 1∗2∗3∗…∗𝑁 𝑥2 𝑥3 𝑥𝑁 series(double x, int N) : 1 − 𝑥 + − + ⋯+ 2 3 𝑁 5. Write a menu driven program to display following patterns:- choice „A‟: 1 Choice „B‟: 1 26 BBB 3 7 10 33333 CCCCCCC 4 8 11 13 5555555555 5 9 12 14 15 6. Write a program to input name and percentage of 35 students of class X in two separate one dimensional arrays. Arrange students details according to their percentage in the descending order using bubble sort method. Display name and percentage of first ten toppers of the class. 7. Write a program to initialize the seven Wonders of the World along with their locations indifferent arrays. Search for a name of the country input by the user. If found, display the name of the country along with its Wonder, otherwise display “Sorry Not Found”. Seven Wonders - CHICHEN ITZA, CHRIST THE REDEEMER, TAJ MAHAL, GREAT WALL OF CHINA, MACHU PICCHU, PETRA,COLOSSEUM Locations – MEXICO, BRAZIL, INDIA, CHINA, PERU, JORDAN, ITALY Example – Country Name : INDIA Output : INDIA - TAJ MAHAL Country Name : USA Output : Sorry Not Found 8. Write a program that create two different arrays and merge two arrays into another array in following ways:- (as example) arr1[ ] = {1, 2, 3, 4, 5, 6}; //first array. arr2[ ] = {7, 8, 9, 0}; //second array. arr3[ ] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0} //resultant array. 9. Write a program that create a class using following : Class name : convert Member variable: long dec, long bin Member Method: convert() : default constructor void accept() : accept value of „bin‟ and „dec‟ from user void DtoB(): convert decimal into its Binary Equivalents. For example: Sample Input: (21)10 Sample Output: (10101)2 void BtoD(): convert binary into its Decimal Equivalents. For example: Sample Input: (11101)2 Sample Output: (29)10 Now call the above method in main