0% found this document useful (0 votes)
4K views2 pages

Class 10 Computer First Unit Test 2023

This document is a sample test paper for Computer Applications for 10th grade students. It contains 2 sections with multiple choice and short answer questions. Section 1 contains 10 multiple choice questions testing concepts like tokens, identifiers, loops, switch statements, operators, and classes. It also has 10 short answer questions about methods, classes, program elements, identifiers, character constants, inheritance, polymorphism, and operators. Section 2 requires students to answer 3 out of 5 long answer questions testing object-oriented concepts, loops, errors, patterns, and data types.
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)
4K views2 pages

Class 10 Computer First Unit Test 2023

This document is a sample test paper for Computer Applications for 10th grade students. It contains 2 sections with multiple choice and short answer questions. Section 1 contains 10 multiple choice questions testing concepts like tokens, identifiers, loops, switch statements, operators, and classes. It also has 10 short answer questions about methods, classes, program elements, identifiers, character constants, inheritance, polymorphism, and operators. Section 2 requires students to answer 3 out of 5 long answer questions testing object-oriented concepts, loops, errors, patterns, and data types.
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
  • Section – I [20 Marks]
  • Section – II [30 Marks]

PRESTIGE SCHOOL

Affiliated to ICSE (KA270), New Delhi


Arkavathi layout, Hennur-Bagalur main road, Bengaluru-77

First Unit Test - JULY 2023


SUBJECT: COMPUTER APPLICATION
GRADE: X Marks: 50
Date: 27-07-2023 Time: 11/2 hrs

INSTRUCTION:
• Answer to this paper must be written on the paper provided separately.
• You will not be allowed to write during the first 10 minutes. Thistime is to be spent in reading the
question paper.

Section – I [20 Marks]


(Attempt ALL questions from this section)

Question 1:
A. Choose the Correct answer: [10]
i) Which of the following is not a token?
(a) Keywords (b) Identifiers (c) Statement (d) Operators
ii) Identify the illegal identifier from the following.
(a) _CHK (b) αβγτ (c) 20_Mark (d) A_Z
iii) Which of the following statements terminates the complete execution of a loop?
(a) stop (b) break (c) continue (d) [Link](0)
iv) Absence of which statement causes a fall-through in a switch statement.
(a) continue (b) stop (c) fall (d) break
v) The Math class is part of which Java library package.
(a) [Link] (b) [Link] (c) [Link] (d) [Link]
vi) i += 2 is equivalent to
(a) i = i++ (b) i = i+2 (c) i =+ 2 (d) i++
vii) Which of the following does not represent a character literal?
(a) ‘a’ (b) “a” (c) ‘1’ (d) ‘\a’
viii) The values of data member or member variables at any given point of time determine an
objects?
(a) Data type (b) state (c) behaviour (d) method
ix) [Link](625, 1/2 ) + [Link](144)
(a) 17.0 (b) 13.0 (c) 37.0 (d) 13
x) The style of expressing single line comment is:
1) /* comment */ (b) /* comment
(c) // comment (d) // comment //

Page 1 of 2
B. Answer the following (50 words): [10]

1) What is a method? Can there be objects without having any methods?


2) Why are objects said to be instances of a class?
3) What kind of program elements are the following?
13, 'a', 4.38925, "a", main( )
4) What is an identifier? What is the identifier forming rule(s) of Java?
5) What is a character constant in Java? How are non-graphic characters represented in Java?
6) Define inheritance.
7) Define polymorphism.
8) Name the operators listed below:

< ++ && ?:
9) What is message passing among objects?
10) What is information hiding?

Section – II [30 Marks]


(Attempt any three questions from this section)

C. Answer the following: [30]


1) How do you map an abstraction into software & how are real world objects
implemented/represented in software terms?
2) Explain the following:
a) Give the output of the following program segment and also mention how many times
the loop is executed.
int i;
for (i = 5 ; i > 10; i++)
[Link](i);
[Link](i * 4);
b) Find the error and explain:
x = 3;
y = 4;
z = [Link](x*x, y/2);
c) Write a program to input three numbers and print their sum of square.
3) Write a program to print a pattern as:
a) 1 b) A
10 AB
101 ABC
1010 ABCD
10101 ABCDE
4) Classify the primitive & non-primitive datatypes. (Explain each primitive data type)
5) Write a program to print a pattern as:
a) 1 2 3 4 5 b) 1
1234 12
123 123
12 1234
1 12345

Page 2 of 2

Common questions

Powered by AI

An identifier in a Java program is a name given to elements such as variables, methods, classes, etc., allowing them to be uniquely identified and accessed within the program. Identifiers must follow certain rules: they can only start with a letter, dollar sign ($), or underscore (_); subsequent characters can also be digits (0-9). Identifiers cannot be keywords, and they are case-sensitive, meaning 'Value' and 'value' would be considered two different identifiers. These rules help in maintaining the clarity and functionality of the code .

Inheritance in Java is a mechanism by which a new class, known as a subclass, is created based on an existing class, referred to as the superclass. It allows the subclass to inherit properties and behavior (methods) from the superclass, enabling code reusability and the creation of hierarchical relationships. Inheritance impacts software development by allowing developers to build upon existing code, leading to lower development time and increased reliability of code. It encourages the use of a common interface and minimizes redundancy, thus improving maintainability .

Information hiding in object-oriented programming refers to the restriction of access to certain parts of an object’s data or methods, typically through the use of access modifiers like 'private' or 'protected'. This prevents external code from depending on its internal structure, thus protecting the integrity of the object. Benefits include enhanced security, ease of maintenance, reduction of complexity, and improved encapsulation. By controlling access, developers ensure that only necessary information is available outside the object, reducing system interdependencies .

Polymorphism in Java refers to the ability of a single function, method, or object to behave differently based on the context in which it is used. It is mainly achieved in Java through method overloading and method overriding. Polymorphism is significant in object-oriented programming as it enhances flexibility and maintainability of code, allowing developers to write more generic and reusable programs. For example, method overriding allows subclasses to provide a specific implementation of a method that is already defined in its superclass, thus enabling dynamic method dispatch .

The error in the computation 'z = math.power(x*x, y/2);' is due to incorrect capitalization of 'math', which should be 'Math'. In Java, all classes from the standard library, including 'Math', should begin with a capital letter. Additionally, 'Math.pow()' should be used for computing powers, and 'y/2' should be corrected to perform the operation without truncation if dealing with integers, perhaps using 'y / 2.0' instead to ensure a proper division. Thus, the corrected statement is 'z = Math.pow(x*x, y/2.0);' .

Message passing in object-oriented programming is the process by which objects communicate with each other by sending messages. This involves calling methods on other objects and passing data as parameters to these methods. This facilitates interaction between objects in a way that encapsulates the details of their interactions, allowing more dynamic behaviors such as complex dependency management and operation sequences. Message passing enhances modularity and reusability because the specifics of how tasks are executed can be hidden, focusing instead on high-level interactions .

In a switch-case construct, the 'break' statement is used to terminate a case once its code has been executed. Without 'break', execution flows through subsequent cases regardless of whether their condition matches, which can lead to unintended logical errors known as 'fall-through'. This can be occasionally desired for executing the same block of code for multiple case conditions. Thus, using or not using 'break' deliberately affects the control flow and should be considered carefully based on the intended outcome .

In Java, primitive data types include byte, short, int, long, float, double, boolean, and char, which are predefined by the language and represent simple values. For instance, int is a 32-bit integer type. Non-primitive data types, or reference types, include classes, interfaces, and arrays. These are created by the programmer and can store multiple values or objects. Examples include String (a class for sequences of characters) and int[] (an array of integers).

The for loop in the provided example has a logic flaw: it initializes the variable 'i' to 5 and checks the condition 'i > 10'. This condition is false from the start, so the body of the loop will not execute any iterations. It’s crucial for the loop's terminating condition to be appropriately set relative to the initial value for the loop to execute correctly. Adjusting either the initialization value or the condition will make the loop meaningful .

In Java, a character literal is a single character enclosed in single quotes, like 'a', whereas a string literal is a sequence of characters enclosed in double quotes, like "a". This distinction is important because character literals in Java are of type char and strings are of type String. Using the wrong type can lead to syntax errors, logic errors in code, or unexpected behavior since they are handled differently by the Java compiler and runtime system .

Page 1 of 2 
PRESTIGE SCHOOL 
Affiliated to ICSE (KA270), New Delhi 
Arkavathi layout, Hennur-Bagalur main road, Bengaluru-
Page 2 of 2 
B. Answer the following (50 words): 
 
 
 
 
 
 
 
[10] 
1) What is a method? Can there be objects without hav

You might also like