Question Bank MCQ Computer Class 10
Question Bank MCQ Computer Class 10
ICSE - CLASS X
Computer Applications
S.No Questions
1. [User Defined Methods]
What is the type of error, if any, when two methods have the same method signature?
(a) Runtime error
(b) Logical error
(c) Syntax error
(d) No error [Understanding]
S.No Questions
4. [User Defined Methods]
Which of the following is a valid method prototype?
(a) public int perform (int a;int b)
(b) public perform (int a, int b)
(c) public int perform (int a, int b)
(d) public perform int (int a, int b) [Analysis]
6. [String handling]
Which of the following is the CORRECT java statement to convert the word
RESPECT to lowercase?
(a) “RESPECT”. tolowercase( );
(b) ”RESPECT”.toLowerCase( );
(c) toLowerCase(“RESPECT”);
(d) String. toLowerCase(“RESPECT”); [Analysis]
7. [Library Classes]
Which of the following are Wrapper classes?
(i) Boolean
(ii) boolean
(iii) character
(iv) Character
8. [Library Classes]
Conversion of a wrapper class to its corresponding primitive type is known as :
(a) unboxing
(b) autoboxing
(c) type casting
(d) parsing [Understanding]
S.No Questions
9. [String Handling]
The String method, which results only in a positive integer, is :
(a) indexOf
(b) lastIndexOf
(c) compareTo
(d) length [Understanding]
11. [Arrays]
The java statement System. out. println(x[x. length]) results in:
(a) logical error
(b) syntax error
(c) run time error
(d) no error [Analysis]
12. [Arrays]
Which of the following is a valid array declaration statement to store the Gender of 80
employees [ ‘M’-male, ‘F’-female, ‘T’-transgender ]?
(a) char gender = new char[80];
(b) char gender[] = new char[80];
(c) char gender[80];
(d) char gender[80] = new char[ ]; [Analysis]
13. [Arrays]
Arrange the following java statements in the correct order of execution to accept values
into the array a[]:
(i) a[i]=sc. nextInt( );
(ii) int a[]=new int[10];
(iii) Scanner sc=new Scanner(System. in);
(iv) for(i=0;i<10;i++)
S.No Questions
14. [Arrays]
In the bubble sort technique, during each iteration of the inner loop, two adjacent
elements are __________and __________.
(i) compared
(ii) swapped
(iii) selected
(iv) deleted
15. [Arrays]
What is the highest index of any array with 100 elements?
(a) 100
(b) 101
(c) 99
(d) 98 [Recall]
S.No Questions
19. [String Handling]
Sham was asked to encode a string S, by replacing the letter E with #. Select the
appropriate statement:
(a) S.replace(‘#’,’E’)
(b) S. replace(‘E’)
(c) S. replace(‘E’, ‘#’)
(d) S. replace(‘#’) [Analysis]
21 [String Handling]
Which of the following String methods has integer argument?
(i) length
(ii) substring
(iii) indexOf
(iv) charAt
S.No Questions
24. [Values and Datatypes]
Which of the following is a valid initialisation statement?
(a) int x = “GOOD”;
(b) int y = 45.0/2;
(c) int z=(int) ‘x’;
(d) int m = false ; [Analysis]
26. [Arrays]
S.No Questions
27. [Iterative Constructs in Java]
28. [Arrays]
S.No Questions
29. [Arrays]
S.No Questions
31. [Values and Datatypes]
Name the data types in order from top, given in the above picture.
(a) int, char, double, String
(b) String, int, char, double
(c) char, double, int, String
(d) int, double, char, String [Understanding]
32. [Arrays]
S.No Questions
34. [Arrays]
The sum of a[1] and a[3] in the array int a[]={20,40,60,80,100} is:
(a) 80
(b) 100
(c) 120
(d) 60 [Evaluate]
35. [Encapsulation]
S.No Questions
37. [Iterative Constructs in Java]
Identify which of the following leads to an infinite loop.
(a) for(i=10;i!=0;i- -)
(b) for(i=3;i<=30;i+=3)
(c) for(i=1;i>=1;i++)
(d) for(i=1;i>=0;i- -) [Analysis]
38. [Constructors]
Assertion: A class can have multiple constructors
Reason: Multiple constructors are defined with same set of arguments.
(a) Assertion is true, Reason is false.
(b) Both assertion and Reason are false.
(c) Both assertion and Reason are true.
(d) Assertion is false, Reason is true. [Understanding & Analysis]
39. [Arrays]
Assertion: An array can store elements of different data types
Reason: An array is a user-defined data type with multiple values of the same data
type but a different memory index.
(a) Assertion is true, Reason is false.
(b) Both Assertion and Reason are false.
(c) Both Assertion and Reason are true.
(d) Assertion is false, Reason is true. [Analysis]
S.No Questions
42. [String Handling]
The output of the statement of “TIGER”. indexOf(‘G’) is:
(a) 3
(b) 2
(c) -1
(d) 0 [Understanding]
S.No Questions
46 [Arrays]
Arrange the following in the descending order of number of bytes occupied.
(i) char x[20]
(ii) int a[4][2]
(iii) double b[6]
47. [Arrays]
Sam performs bubble sort on the following array to organise the elements in ascending
order:
{5,1,2,3}
After the first comparison the array is:
{1,5,2,3}
What would be the array after the next comparison?
(a) {1,2,5,3}
(b) {1,5,3,2}
(c) {1,3,5,2}
(d) {1,3,2,5} [Understanding & Analysis]
S.No Questions
48 [Mathematical Library Methods]
Write the java statement for:
Sum of a raised to b and cuberoot of c [Understanding]
S.No Questions
50. [Library Classes]
Name the following:
(a) A Character method that checks whether a character is an alphabet or a number.
(b) A Math method that does not have an argument. [Understanding]
S.No Questions
54. [Iterative Constructs in Java]
Give the output of the following program segment:
for(k=a;k<=a*b;k+=a)
{ if (k%b==0)
break;
}
System. out. println(k);
Give the output when a=6, b= 4. [Application]
58. [Operators]
Mention the output of this code snippet:
int lives = 5;
System.out.println(lives--);
System.out.println(lives); [Analysis]
S.No Questions
59. [Iterative Constructs in Java]
Convert the following for loop segment to an exit-controlled loop.
for(k=10;k>= -1;k- -)
System. out. println(k*2);
System. out. println(k*4); [Analysis]
60. [Arrays]
Give the output of the following program segment:
int x[]={2,45,7,67,12,3};
int i, t=0;
for(i=0, t=5;i<3;i++,t- -)
{
System. out. println(x[i]+x[t];
} [Analysis]
61. [Arrays]
Write Java statements for the following:
(a) Initialise the array with the three favourite subjects.
(b) Declare an array to store the marks in 3 subjects of 40 students. [Understanding]
63. [Encapsulation]
Consider the following program segment and answer the questions given:
for(int k=1;k<=5;k++)
System. out. println(k);
System. out. println(k);
(a) Will the program segment get executed successfully?
(b) If not, state the type of error?
(c) How do you correct the program if it has any error? [Analysis]
S.No Questions
64. [Arrays]
Consider the array:
int a[]={12,35,40,22,56,9,70};
(a) In the above given array, using linear search, how many iterations are required to
check for the existence of the value 56?
(b) If the array is arranged in descending order, how many iterations are required to
check for the existence of 56 using linear search? [Analysis]
66. [Arrays]
Consider the following program which calculates the Norm of a matrix. Norm is square
root of sum of squares of all elements.
Fill in the blanks (a) and (b) with appropriate java statements:
double norm()
{ intx[][]={{1,5,6},{4,2,9},{6,1,3}};
int r, c, sum=0;
for(r=0;r<3;r++)
{ for( c=0;c<3;c++)
sum=sum+_____(a)_____;
}
____(b)________;
} [Analysis]
S.No Questions
68. [String Handling]
Give the output of the following program segment:
void encode()
{
String s= “DICe”;
char ch;
for(i=0;i<4;i++)
{ ch=s. charAt(i);
if(“AEIOUaeiou”. indexOf(ch)>=0)
System.out. println(“@”);
else
System.out. println(ch);
} [Analysis]
69. [Arrays]
Name the following:
(a) What is the main condition to perform binary search on an array?
(b) A sort method in which consecutive elements are NOT compared.
[Understanding]
70. [Input in Java]
Answer the following:
(a) Scanner class method to accept a character.
(b) Jump statement which stops the execution of a construct. [Understanding]
S.No Questions
72. [User Defined Methods]
The BHDB company offer EMI (Equated Monthly Instalments) based loans for the
purchase of electronic devices based on the purchase amount the rate of interest is
offered as follows:
Purchase amount less than Rs.20000, rate of interest is 12% otherwise the rate of
interest is 15%.
Amount with interest for the specified number of years is calculated using the formula
Amount = p(1+r/100)^n
Where p is the purchase amount, r is the rate of interest, n is the number of years.
After the amount is calculated it is converted into EMI by dividing the amount by the
number of months of the tenure, which has to be a whole number rounded off to the
nearest integer.
Print the details as follows:
Purchase amount:
Rate of interest:
Amount with interest:
EMI:
Define a class to accept the purchase amount and the number of years of the tenure,
calculate and print the details as per the above specifications. [Application]
S.No Questions
74. [Iterative Constructs in Java; Nested for Loops]
(a) Define a class to print the Floyds triangle of given rows using nested loops only.
Example:
A Floyd triangle of 6 rows is
1
23
456
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
(b) Define a class to print the sum of the following series:
1+(1+2)+(1+2+3)+..........(1+2+3……20) [Analysis]
S.No Questions
76. [Arrays]
Define a class to accept values into a 3x3 array and check if it is a Losho grid or not.
A grid is a Losho grid if the sum of each row and column equals 15.
Print appropriate messages.
Example: 4 9 2
357
816 [Application]
S.No Questions
79. [Arrays]
A teacher prepares the statistics of 100 students in ICSE 2024 on the subject Computer
Applications as follows:
Range No. Of students
Above 90
80 - 90
60 - 80
Below 60
Define a class to accept the marks of 100 students in an array and print the statistics as
mentioned above. [Application]