0% found this document useful (0 votes)
53 views10 pages

ICSE Computer Applications IX Assignment

The document is an assignment for ICSE Computer Applications for Class IX, covering topics such as Object Oriented Programming, data types, operators, and error handling in Java. It includes multiple-choice questions, short answer questions, and programming exercises to assess understanding of the concepts. The assignment is structured into sections that test both theoretical knowledge and practical programming skills.
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)
53 views10 pages

ICSE Computer Applications IX Assignment

The document is an assignment for ICSE Computer Applications for Class IX, covering topics such as Object Oriented Programming, data types, operators, and error handling in Java. It includes multiple-choice questions, short answer questions, and programming exercises to assess understanding of the concepts. The assignment is structured into sections that test both theoretical knowledge and practical programming skills.
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

Computer Applications

(ICSE)
Assignment

IX
Chapter 1

Mental Drill

A. Tick (🗸) the correct option.


1. Name the programming technique that implements programs as an organised collection of
interactive objects.
a. Procedure Oriented Programming b. Modular Programming
c. Object Oriented Programming d. None of these

2. Name the characteristics of Object Oriented Programming that hides the complexity and
provides a simple interface.
a. Encapsulation b. Polymorphism
c. Abstraction d. Inheritance
3. Which among the following operator is used to access individual members of an object?
a. . (dot) b. + (plus)
c. – (minus) d. / (divide)
4. Which among the following modifier is used in a ‘class’?
a. public b. default
c. Both a and b d. None of these
5. Which among the following is a valid class name?
a. Simple Interest b. SimpleInterest
c. 1SimpleInterest d. Simple@Interest
6. Which among the following is a valid object name?
a. obj1 b. 1obj
c. Obj 1 d. Obj#1

7. Which among the following is a valid float literal?


a. 12.36f b. 12.36F
c. 12.36 d. Both a and b

8. Which among the following is a valid octal integer literal?


a. 0178 b. 675
c. 0675 d. 0X675
9. Which among the following is a valid method of initialising?
a. boolean f=true; b. boolean f=True;
c. boolean f=’true’; d. None of these
10. Which among the following is not a punctuator?
a. ; semicolon b. , comma
c. : colon d. . dot
11. Which among the following is not a primitive data type?
a. int b. float
c. String d. char
12. What is the largest possible value that can be stored in short data type?
a. 215-1 b. 231-1
c. 27-1 d. 263-1

13. If a is of type int and b is of type float what would be the resultant data type of a+b?
a. int b. float
c. double d. short

Section A
Answer the following questions:
1. How are objects implemented in software?
2. What is abstraction? How is encapsulation related to it?
3. Define Encapsulation.
4. What is Inheritance?
5. What is Object Oriented Programming?
6. State three differences between Procedure Oriented Language and Object Oriented Languages.

7. State the four characteristics/principles of Object Oriented Programming.


8. What are keywords? Give an example.
9. What are identifiers?
10. What is a literal?
11. Why is an object called an instance of a class?
12. Write one difference between primitive data type and composite data type.
13. Give one example each of primitive data type and composite data type.
14. State two differences between a class and an object.

15. Give one point of difference between unary and binary operators.
16. What do you understand by type conversion?
17. State the difference between a Boolean literal and a character literal.
18. Identify the literals as given below:
i. 0.5 ii. ‘A’ iii. false iv. “a”

19. Which two access specifier is used in a class declaration?


20. Why is a class called an object factory?
21. of n if the value of p=5 and q=19:
int n = (q-p)>(p-q)?(q-p):(p-q);
22. What is meant by precedence of operators?
23. What is Operator Associativity?
24. What does a class encapsulate?
25. State the Java concept that is implemented through:
i. A super class and a sub-class.
ii. The act of representing essential features without including background details.
26. Write a statement in Java that will declare an object named si of the SimpleInterest class.

27. Which among the following are invalid class names in Java? State with reasons.
i. Compound Interest ii. 1MyClass iii. MyClass$ iv. Myclass#
v. My@Class

28. What is the resultant data type of the following mathematical expression?
a+b*c-d
a. where a is int, b is int, c is float and d is float type
b. where a is float, b is long, c and d is of int type
c. where a is of double and b,c and d are of int type
d. where a is char and b,c and d are of int type
e. where a, b, c and d are of int type, however the expression is slightly modified as (a+b*c-d)/7.0
29. What will be the output of the following programs?

30. What will be the output when the following code segment is executed?
[Link](“The king said \”Begin at the beginning!\ “to me”);
31. [Link](“BEST “);
[Link](“OF LUCK”);
Choose the correct option for the output of the above statements:
i. BEST OF LUCK
ii. BEST
OF LUCK
32. What is the value of y after evaluating the expression given below?
y+=++y + y-- + --y; when int y=8

33. Give the output of the following expression:


a+=a++ + ++a + --a + a--; when a=7.
34. If int y=10 then find:
int z=(++y * (y++ +5));
35. What are the values of x and y when the following statements are executed?
int a = 63, b = 36;
boolean x = (a < b ) ? true : false;
int y= (a > b ) ? a : b;

36. What will be the result stored in x after evaluating the following expression?
int x=4;
x += (x++) + (++x) + x;
37. What will be the output of the following code?
int k = 5, j = 9;
k += k++ – ++j + k;
[Link](“k=” +k);
[Link](“j=” +j);

38. What is the result stored in x, after evaluating the following expression?
int x = 5;
x = x++ * 2 + 3 * –x;
39. Write the output of the following:
[Link](“Incredible”+“\n”+“world”);
40. Name the operators listed below:
i. < ii. ++ iii. && iv. ?:

41. State the number of bytes occupied by char and int data types.
42. Write one difference between / and % operator.
43. Name the primitive data type in Java that is:
i. a 64 bit integer and is used when you need a range of values wider than those provided by int.
ii. a single 16-bit Unicode character whose default value is ‘\u0000’.
SECTION B
1. Write a program to find the sum and difference between 25 and 16 using variables in
different
lines.
2. Write a program to find the product of 5, 7 and 12 using variables.
3. Write a program to find the product of the sum and difference between 17
and 2 using
v
ari
abl
es.
4. Write a program to average of 36, 45 and 53 using variables of adequate data
type.
5. Write a program using int variables to find the sum of three numbers say 15, 36
and 45 and
subtract the result from 100 using variables.

6. Write a program to display the names of five fruits with a single


[Link](); statement, but in different lines.
7. Write a program to find the sum, difference and product of 12.35 and 7.3 using
variables with a single [Link](); statement, however with horizontal
tab space in the result.
8. Write a program using float type variables to find the area and perimeter of a
square whose
side is 12.5 cm.
9. Write a program using int variables to find the area and perimeter of a rectangle
of length
12cm and breadth 8cm.

10. Write a program using variables to find the profit and profit percent of a certain
transaction
where
S.P.= `10000 and C.P.= ` 7000.
11. Write a program to input the Principal, Rate and Time and calculate the Simple
Interest.
12. Write a program using variables to find the area and circumference of a circle whose
radius is
12cm.
Note that :
Area of a circle= π r2
Circumference of a
circle = 2 π r
where r is the radius of the circle and π is 3.142.
13. Write a program to initialise two integer variables a and with 5 and 6
respectively and interchange them. Thus after interchanging, a and b will be 6
and 5 respectively.

14. Write a program to initialise three int variables a, b and c with 234, 456 and 712 and
store the
sum of the last digits of the variables into d and display it.

15. Write a program to initialise an int variable a with 76498 and from it extract the
first digit and store it into a variable f and extract the last digit into a variable l
and display both these digits.

16. write a program using ternary operator to check whether 27 is a multiple of 3 or not.

17.
Chapter 2
Revision Tour II

Mental Drill

A. Tick (🗸) the correct option.


1. Which among the following is not a valid error in Java?
a. Syntax errors b. Logical errors
c. Run-time errors d. Technical errors
2. Which among the following Scanner methods allows us to input a number with a
decimal point?
a. nextInt() b. nextFloat()
c. nextDecimal() d. nextPoint()
3. The output in BlueJ occurs in which window?
a. Console window b. Terminal window
c. Both a and b d. None of these
4. The input in BlueJ occurs in which window?
a. Console window b. Terminal window
c. Both a and b d. None of these
5. Assigning value to a variable during declaration is called.
a. Declaration b. Assignment
c. Initialisation d. None of these
6. Which among the following is used to represent single-line comment?
a. // b. /* c. \\ d. <!—
7. Which among the following is a logical error?
a. Missing semicolon b. Mismatched braces in classes and
methods.
c. Misspelled keywords and identifiers. d. Addition is required but subtraction is
performed.

8. Which among the following represents a syntax error?


a. Dividing an integer by zero.
b. Accessing an element that is out of bounds of an array.
c. Trying to store a value which is incompatible to a certain data-type.
d. Missing semicolon

9. If the data that is to take part in a calculation in a method is fixed, which


form of input is necessary?
a. Initialisation b. Parameterised input
c. Scanner input d. None of these
10. In case you need to give a proper message (prompt string) before taking an input
from the user, which would be the most preferable method?
a. Parameterised input b. Initialisation
c. Scanner input d. None of these

SECTION A
Answer the following questions.
1. Name the functions of the Scanner that is used to:
(i) Accept a number of long data type
(ii) Accept a group of alphabets.
2. What is a bug? What is debugging?

3. What are the different types of errors that may occur in a Java program?
4. What are syntax errors? Give two examples.
5. What are run-time errors? Give two examples.

6. What are comments? Name the different types of comments used in Java.
7. What are conditional statements? With which commands do you implement
conditional statement in Java?
8. When are braces optional or necessary in conditional statements?
9. What is the difference between the Scanner class functions next() and nextLine()?
10. hat are relational operators?
11. State the difference between = and = =.
12. What are logical operators? Explain each of them with the help of an example.

Common questions

Powered by AI

Primitive data types are the most basic data types provided by a programming language, such as int, char, and float, which represent single values directly in memory. Composite data types, like arrays, classes, and interfaces, are constructed using primitive types and other composite types to form more complex data structures. For example, an `int` is a primitive data type defined to store integer values, whereas an array of integers is a composite type that can hold multiple integer values in a sequence. Primitive types are more memory-efficient, while composite types provide greater flexibility for managing complex data .

Type conversion in programming is the process of converting a variable from one data type to another. Implicit type conversion, or coercion, is automatically performed by the compiler when it sees an operation with two different types, where it converts one type to another to ensure compatibility (e.g., converting an int to a float in arithmetic operations). Explicit type conversion, or casting, requires the programmer to manually specify the conversion, such as casting a float to an int with potential precision loss. Implicit conversion is automated and safer, while explicit conversion provides more control and precision but requires awareness of potential data loss .

A Java class is referred to as an 'object factory' because it defines a blueprint for creating objects. Each instance of a class is an object, and the class itself provides the structure and behavior that the objects will share. This concept highlights the role of classes in generating new objects based on the defined structure and encapsulated logic. By treating classes as factories, developers can efficiently create and initialize multiple instances with consistent behavior and properties, facilitating scalable software design .

Inheritance allows a new class to inherit properties and behaviors from an existing class, known as the superclass. This reuse of code promotes efficiency and reduces redundancy, as common functionality can be centralized in the superclass and extended or modified in subclasses. As a result, inheritance supports software reusability by enabling developers to build upon existing, tested code instead of writing new code from scratch for similar functionalities, thus enhancing maintainability and reliability .

Braces in Java delineate the beginning and end of a block of code, making them essential in conditional statements to explicitly indicate which statements depend on the condition. When a conditional statement or loop controls multiple statements, braces are required to group these statements into a block. However, if only one statement is controlled by the condition, braces are optional. Correct use of braces avoids ambiguity and enhances code readability, ensuring that only the intended blocks of code are executed under the specified conditions .

The four main principles of Object-Oriented Programming are encapsulation, abstraction, inheritance, and polymorphism. Encapsulation helps in hiding the internal state and requiring all interaction to occur through an object's methods, ensuring a controlled access and modification to the data. Abstraction allows focusing on essential qualities by separating the high-level requirements from the low-level details. Inheritance promotes reusability, enabling new objects to adopt properties of existing ones. Polymorphism allows objects to be treated as instances of their parent class rather than their actual class, facilitating flexibility and the ability to reuse interfaces. These principles collectively contribute to building modular, flexible, and reusable code .

In Object-Oriented Programming, encapsulation is a principle where data and the methods that operate on that data are bundled into a single unit, known as an object. This hides the internal state of the object from the outside world, allowing only specific operations to be accessible. Abstraction is related in that it allows a programmer to represent complex realities with simplified models, concentrating on necessary elements while ignoring lesser details. Encapsulation supports abstraction by providing a simple interface to the user while keeping the implementation details hidden .

Object-Oriented Programming (OOP) is a programming paradigm where programs are structured as a collection of 'objects' that communicate with each other to perform tasks. This paradigm focuses on data encapsulation, abstraction, inheritance, and polymorphism, providing a modular approach to software development. In contrast, Procedure-Oriented Programming (POP) is organized around procedures or functions and concentrates on writing sequences of operations to be executed. OOP differs from POP in that it emphasizes data hiding and reuse, whereas POP emphasizes a linear approach to executing procedures .

Logical operators in Java are used to combine multiple boolean expressions or conditions. The three main logical operators are AND (&&), OR (||), and NOT (!). The AND operator returns true if both operands are true (e.g., `x > 5 && y < 10`), the OR operator returns true if at least one operand is true (e.g., `x == 5 || y == 10`), and the NOT operator inverts the value of a boolean expression (e.g., `!true` evaluates to false). These operators are fundamental in control structures such as if statements and loops to test composite conditions .

Operator precedence in Java determines the order in which operators are evaluated in expressions. Operators with higher precedence are evaluated before operators with lower precedence. For example, in the expression `a + b * c`, the multiplication operator `*` has higher precedence than the addition operator `+`, so `b * c` is evaluated first, followed by the addition of `a`. Understanding operator precedence ensures accurate calculation results and helps avoid logic errors in complex expressions .

You might also like