0% found this document useful (0 votes)
242 views6 pages

Class X Computer Application Pre-Board Exam

The document is a pre-board exam paper for Class X at SNV International School, focusing on Computer Applications. It includes multiple-choice questions and programming tasks covering various concepts in Java, such as error identification, array manipulation, and class design. Additionally, it contains sections for practical programming exercises and theoretical questions related to data structures and algorithms.

Uploaded by

Ja Haha
Copyright
© © All Rights Reserved
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% found this document useful (0 votes)
242 views6 pages

Class X Computer Application Pre-Board Exam

The document is a pre-board exam paper for Class X at SNV International School, focusing on Computer Applications. It includes multiple-choice questions and programming tasks covering various concepts in Java, such as error identification, array manipulation, and class design. Additionally, it contains sections for practical programming exercises and theoretical questions related to data structures and algorithms.

Uploaded by

Ja Haha
Copyright
© © All Rights Reserved
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

SNV International School, Nadiad

Class: X Pre Board Exam Date: 31 /12/24


Max Marks: 100 Subject: Computer application Time: 2 hours
________________________________________________________________________
SECTION I (40 Marks)
Attempt all questions from this Section
Question 1 [20X1=20]
(i)

Consider the above picture and choose the correct statement from the following:
a. Vehicles is the object and the pictures are classes
b. Both vehicles and the pictures are classes
c. Vehicles is the class and the pictures are objects
d. Both vehicles and the pictures are objects.
(ii) Identify the type of error in the following code: double a; a=[Link]();
a. Syntax Error b. Logical error
c. Runtime Error d. No error in the code
(iii) String a[]= {―MI‖, ―SAMSUNG‖, ―MICROMAX‖, ―ONE PLUS‖,
MOTOROLA};
Give the output of the following statement:
[Link](a[3].replace(‗O‘, ‗*‘));
a. *NE PLUS b. MICR*MAX
c. M*T*R*LA d. MI
(iv) An array elements are always stored in memory locations.
a. Sequential b. Random
c. Sequential and random d. Binary
(v) Give the output of the following : int x=2, y=4, z=1;
int result = (++z) + y + (++x) + (++z);
a. 11 b. 12
c. 10 d. 9
SNV/PRE/24-25/COMP/TT

Page 1 of 6
(vi) The array int a[] with 7 elements occupy:
a. 40 bytes b. 14 bytes
c. 7 bytes d. 28 bytes
(vii) What will be the value of a in the given code: double b=-15.6;
double a= [Link]([Link](b));
[Link](―a=‖+a);
a. 14 b. 16 c. 16.0 d. 17.0
(viii) What will be the output of the following code: boolean p;
p = (―BLUEJ‖.length()> ―bluej‖.length()) ? true:false;
a. 1 b. 0 c. false d. true
(ix) For a given array int x[]= {11, 22, 33, 44, 55}; the value of x[1+2] is
a. 11 b. 22 c. 33 d. 44
(x) What will this code print?
int arr[] = new int [5];
[Link](arr);
a. 0 b. Value stored in arr[0]
c. 0000 d. Garbage value
(xi) What will be the final value stored in variable x? double
x=[Link]([Link](-7.3),7.0);
a. 7.0 b. 7.3
c. 6.0 d. 8.0
(xii) Which of the following declaration and initialization in the below line
equivalent to?
String str= new String();
a. String str= ― ‖; b. String str= ― 0‖;
c. String str= null; d. String str= ― \0‖;
(xiii) Which of the following option is used to find the size of the given
array? char m[] = { ‗R‘ , ‗A‘, ‗J‘, ‗E‘, ‗N‘ , ‗D‘, ‗R‘, ‗A‘};
a. [Link](a); b. [Link](m);
c. [Link]; d. [Link]();

(xiv) Assersion(A) : An argument is a value that is passed to a method when it is


called.
Reason(R) : Variables which are declared in a method prototype to receive
values are called actual parameters.
a. Both assertion(A) and Reason(R) are correct and Reason (R) is
correct explanation of Assertion.
b. Both assertion(A) and Reason(R) are correct but Reason (R) is not the

Page 2 of 6
correct explanation of Assertion.
c. Assertion (A) is true Reason(R ) is false.
d. Assertion (A) is false Reason(R ) is true.
(xv) Assertion (A) while loop is an entry-controlled loop.
Reason ( R ) while loop execute the statements first and then checks the
condition.
a. Both Assertion (A) and Reason( R) are true and Reason (R) is a
correct explanation of Assertion(A)
b. Both Assertion (A) and Reason( R) are true and Reason (R) is not a
correct explanation of Assertion(A)
c. Assertion (A) is true and Reason( R) is false
d. Assertion (A) is false and Reason( R) is true
(xvi) Which of the following method returns a boolean value?
a. toLowerCase() b. toUpperCase()
c. parseInt() d. isUpperCase()
(xvii) Identify the correct array declaration
a. int [] d=new int[9]; b. int d[]=9;
c. int d[]=new int[]; d. int d[9];
(xviii) What will be the output of the following code?
[Link](―Lucknow‖.substring(0,4));
a. Lucknow b. Luckn
c. Luck d. Luckno
(xix) Consider the following code snippet : if(c>d) x=c; else x=d;
Choose the correct option if the code mentioned above is rewritten
using the ternary operator?
a. x=(c>d)?c:d; b. x=(c>d)?d:c;
c. x=(c>d)?c:c; d. x=(c>d)?d:d;
(xx)The technique in which the change in the formal parameter gets reflected in the
actual parameter is known as:
a. Call by reference b. Call by value
c. Call by argument d. Call by method

Question 2 [10X2=20]
(i) What is the output of the following code? char ch = ‗x‘;
char ch1=[Link](ch); int p= (int)ch1;
[Link](ch1+ ―\t‖+p);
(ii) What will be the output of the following code segment and how many times does
the loop execute?

Page 3 of 6
int a[]={2,4,12,6,10,14};
int m=0,n=0,p=0;
for(int k=0;k<2;k++)
{
m=a[2]++;
n=a[3]++;
p=a[4];
if(m==12)
break;
}[Link].print1n(m+n+p);

(iii) Write a java expression for the following: Z=X3+Y2-√X


(iv) Rewrite the following code using while loop:
int x=1, y=2;
for(x=1; x<=14; x++, y +=1)
{
[Link](― ―+ x++);
}
[Link](―Welcome to Java Programming‖);
(v)Give the output of the following code snippet:
String s1= ―HELLO‖, s2= ―hello‖;
[Link]([Link](s2));
[Link]([Link](s2));
(vi)Write a prototype of function abc which takes a string argument and a character
argument and returns an integer value.
(vii)Give the output of the following code snippet
String color;
String s= "Color";
color = [Link](" " +" YELLOW");
[Link]([Link]('o', 'O'));
[Link]([Link]()); (viii) x[]= {5, 4, 3, 4, 7, 8};
Rohan is considering the above array; he needs to multiply the second element of the
array with sixth element and add the result to the third element. What should be the
correct code for the same? Also write the value after calculation.

Page 4 of 6
(ix) State the datatype and value of b after the following code is executed:
char a= ‗8‘;
b=[Link](a);
(x) State the method.
i. Convert a string to a primitive float data type.
ii. Determines if the specified character is an upper case character.

Section B
(Answer any four questions from this Section.)
Data description table, Input/output, and comments is compulsory.

Question 3 [15]
Design a class name ShoppingMall with the following description:
Instance variables / Data members:
String name — To store the name of the customer
long mobno — To store the mobile number of the customer
double cost — To store the cost of the items purchased
double dis — To store the discount amount
double amount — To store the amount to be paid after discount
Member methods:
ShoppingMall () — default constructor to initialize data members
void accept() — To input customer name, mobile number, cost
void calculate() — To calculate discount on the cost of purchased items, based on
following criteria
Cost Discount (in percentage)
Less than or equal to ₹10000 2%
More than ₹10000 and less than or equal to ₹20000 5%
More than ₹20000 and less than or equal to ₹35000 7%
More than ₹35000 10%
void print() — To display customer name, mobile number, amount to be paid after
discount.
Write a main method to create an object of the class and call the above member
methods.

Question 4 [15]
Write a program to enter to store 10 students and their 5 digit enrolment number in
two single dimensional arrays. Enter a name separately and search it in the given
list of names. If the name is present then display the name and corresponding

Page 5 of 6
enrolment number using linear search technique. If the name not found display
appropriate message.

Question 5 [15]
Write a program to calculate the norm of a number. Norm of a number is square
root of sum of squares of all digits of the number.
Example the norm of 68 is 10.
6X6+8X8=36+64=100. The square root of 100 is 10.

Question 6 [15]
Design a class to accept integers in a matrix (double dimensional) of 3x3
Display the sum of the left and right diagonal. If the left and right diagonal is same
then display the matrix as ―Cross Matrix‖ otherwise ―Non-Cross Matrix‖.

Question 7 [15]
Write a program in Java to accept a String in a mixed case (including digits and
special characters). Perform the following tasks as per the user‘s choice:
1. Count and display the number of vowels
2. Count and display the digits
3. Count and display the number of special characters excluding whitespaces
Sample Input: 15 August is celebrated as: ―Independence Day‖
Sample Output: Number of vowels : 15
Number of digits : 2
Number of special characters : 3

Question 8 [15]
Write a program to overload a function print() as per the details given below:
(a) void print (String st, Char ch) – to display all vowels in the string
if ch is ‗v‘ else display all the characters.
(b) void show(int p): To print the prime digits present in the given number
Example: p=4329
Output: 2, 3
(c) void print () – to print the following pattern.
1
3 1
5 3 1
7 5 3 1

Page 6 of 6

Common questions

Powered by AI

Assertions in programming logic, such as 'Assertion(A): An argument is a value passed to a method' and 'Reason(R): Variables declared in a method prototype to receive values,' help validate understanding of parameter passing and method functionality. Effectively employed in education, they facilitate critical thinking and verification of conceptual knowledge, reinforcing logical evaluation skills necessary in algorithm design and software testing by challenging students to assess the factual correctness and relevance of associated reasons .

In memory storage, arrays typically use 'sequential' storage, meaning elements are stored in contiguous memory locations. This enables efficient index access but requires preallocation of needed memory space. In contrast, 'random' (or non-contiguous) memory allocation, often related to structures like linked lists or trees, allows flexible memory use but may necessitate pointers and can incur additional overhead for access operations. Understanding these distinctions aids in optimizing memory management for high-performance applications and system design .

The 'Norm' of a number is calculated by taking the square root of the sum of the squares of its digits. For instance, for the number 68, you square each digit (6^2=36, 8^2=64), then sum these results (36+64=100), and finally compute the square root of this sum to get the norm (√100=10). This process is crucial in applications requiring gradient-like or norm-based procedures in advanced mathematics or computer graphics .

The code suggests a type mismatch issue, which may lead to a syntax error if the correct method or conversion is not applied. 'ob.nextInt()' returns an integer, whereas 'a' is a double. This mismatch could result in a syntax error unless an explicit cast is used to convert the integer returned by 'ob.nextInt()' to a double type .

The conditional (ternary) operator '? :' allows inline conditional expressions, enhancing code readability and conciseness compared to traditional 'if-else' statements. Using 'x = (c > d) ? c : d;', it simplifies the decision structure by directly choosing values based on Boolean evaluation in a single statement. This reduces verbose control flow constructs, promoting clarity, especially in assignments or return statements, vital in scenarios like concise value selection in data streams .

Control structures, such as nested loops, facilitate iteration over multi-dimensional arrays like matrices to perform operations like diagonal sums. In a 3x3 matrix, iterating with 'for' loops allows accessing each element by its indices to aggregate sums of both main ('left') and secondary ('right') diagonals. Creative applications use conditional checks to compare these sums (e.g., 'Cross Matrix' vs. 'Non-Cross Matrix'), demonstrating iterative control understanding vital for complex data manipulations and visualization tasks in data science or graphics .

The 'while' loop is an entry-controlled loop, meaning it evaluates the condition before executing the loop's body. Conversely, a 'for' loop also checks the condition before execution but is more suited for iteration over a range with an init, cond, increment structure. The 'do-while' loop is an exit-controlled loop; it executes the loop's body first and checks the condition afterward. This distinction inherently defines their operational difference and usage .

The method 'String.concat()' in Java concatenates two or more strings, returning a new string with the combined content. Unlike some languages with operator overloading, Java does not allow the '+' operator to concatenate 'String' objects natively through overloading; instead, '+' is specially treated for 'String' concatenation, which implicitly calls a form of string builder, making 'String.concat()' directly reliant on the String class's method for clarity and Java's type safety .

Method overloading in Java allows multiple methods with the same name but different parameters or parameter types to coexist within the same class. This enhances flexibility and reusability, allowing developers to use the 'print()' function with different arguments or data types. In the context given, overloading allows 'print()' to display different outputs based on parameters, enabling specialized behavior such as printing vowels when a particular condition is met or performing arithmetic-like operations with its variations, demonstrating polymorphism .

The concepts demonstrated are that 'vehicles' can be seen as a class, which is a blueprint for creating objects like 'pictures'. In OOP, a class defines the properties (attributes) and behaviors (methods) that the objects created from the class may have. Hence, vehicles representing a class and pictures representing objects conforms to the fundamental OOP principle of class-object structure .

You might also like