Skip to main content

Computer applications icse notes

What is a wrapper class? Give few examples of wrapper classes.
Ans. The wrapper class encapsulate or wrap the primitive data-types within a class to form an object representation of it.
Examples of wrapper classes
2. What are access specifiers?
Ans. Access specifiers are keywords which is used to declare which entity cannot be accessed from where. Its effect has different consequences when used on a class, class member (variable or method), and constructor. Java offers four access specifiers, listed below in decreasing order of accessibility:
 public
 protected
 default/friendly
 private
3. Name the wrapper class function that converts an integer to a:
i) Binary Number
ii) Octal Number
iii) Hexadecimal Number
Ans. iInteger.toBinaryString( ) ;
ii) Integer.toOctalString( );
iii) Integer.toHexString( );
4. State the difference between parse...( ) and valueOf() method.
Ans. The parse...( ) method of the wrapper class converts a String to its corresponding primitive data type and returns it whereas valueOf() method converts a String to the corresponding wrapper object and returns it.
5. State the similarity difference between private and default access apecifier.
Ans. Similarity between private and default access specifier is that both allows accessibility within the class.
Difference between private and default is that private access specifier allows accessibility only within the class and default access specifier allows accessibility to all classes within a package.
6. What is a package? State its significance.
Ans. Package is a folder that contains compiled classes having both a name and a visibility control mechanism for using its function in another class.
A package gives you an organized way of managing classes in Java. You can group related classes into a package thus making it more organized. Similarly it is possible to define classes inside a package that are not accessible by code outside the package. There may also be classes that are only exposed to other members of the same package. This allows the classes to have intimate knowledge of each other, but do not expose it to the entire world.
7. Why can’t a class be declared as private?
Ans. A class when defined as private, it will be impossible to access its members and thus making it unusable.
8. Write the statement to import all classes from the Simple package.
Ans. import Simple.*;
9. What is a method?
Ans. Function or Method is a block of code containing executable lines of code that represents the behavioural aspect of an object.
10. Write two advantages of using functions in a program.
Ans. The Advantages of using functions are:
a) Reduces Complexity: Breaking a large task into smaller tasks automatically reduces complexity, thereby increasing the maintainability of the program.
b) Reusability: Once a method is defined, it can be invoked again and again from different segments of a program thus reusing the method whenever required.
11. Explain the function of a return statement.
Ans. The return statement is used to return-back or exit from a function. It comes in two variants:
1. return; It is generally used with function having void return-type and is used to explicitly force an exit from the function.
2. return <value>; It is used with function which have to return a value to the place where it is called from. Thus it is used with functions having return-type anything other than void. This statement not only forces an exit from the function but also returns a value.
12. If a function contains several return statements, how many of them will be executed?
Ans. If a function contains several return statements, only the first one which JVM comes across is executed. Thus forcing an exit from the function and therefore the remaining return statements are not executed.
13. Name the keyword that causes the control to transfer back to the method call.
Ans. The keyword that causes the control to transfer back to the method call is –return.
14. What is the role of the keyword void in declaring functions?
Ans. The void return-type of a function is used to ensure that a function do not return any value.
15. Classify functions depending upon the value it returns.
Ans. Depending on the value that is returned by a function, it is classified as:
a) Computational Function
b) Manipulative Function
c) Procedural Function
16. Differentiate between Formal Parameter and Actual Parameter.
Ans. The difference between Actual Parameters and Formal Parameters are:
17. How are functions called? How does it return a value?
Ans. A function may be called or executed in Java by simply writing the function name followed by the parameter-list within parenthesis. For example, if a function prototype contains the following:
void totalSurfaceArea(float l, float b, float h);
when calling the function it should be specified as:
totalsurfaceArea(x,y,z);
where x, y and z are variables of float type and are assigned to l, b and h respectively.
After a function computes a value, it can be returned to the place where it is invoked using the general syntax:
return <value>;
18. What is call by value?
Ans. During call by value a copy of the actual parameters is made by the formal parameters and therefore any changes made to the formal parameters is not reflected by the actual parameters.
19. State the difference between Call by Value and Call by Reference.
Ans. The difference between Call by Value and Call by Reference is that:
20. How are the following passed?
i) Primitive types
ii) Reference types
Ans. i) Call by Value
ii) Call by Reference
21. Classify functions which accepts objects as parameters.
Ans. i) Pure Functions
ii) Impure Functions
22. Define an impure function.
Ans. Impure functions are such methods which change the state of an object.
23. Differentiate between pure and impure functions.
Ans. Difference between Pure and Impure functions:
24. Explain function overloading with an example.
Ans. Multiple functions with the same name but different parameter list is termed as function overloading. When an overloaded function is invoked, Java uses the type and/or number of arguments as its guide to determine which version of the overloaded method to actually call.
25. Which OOP principle implements function overloading?
Ans. The principle of Polymorphism is implemented using Function Overloading.
26. When there are multiple definitions with the same function name, what makes them different from each other?
Ans. When there are multiple definitions with the same name, the parameter-list makes them different from each other.
27. What are the different access specifiers available in Java?
Ans. The different access specifiers in Java are: default, public, protected and private.
28. What is the function of main( ) method?
Ans. In conventional Java the main( ) function is from where the program execution begins and is therefore also called the driver function. In BlueJenvironment main() do not have any relevance at all it behaves exactly like any other function in Java.
29. How are static methods of one class called by methods in other classes?
Ans. Methods which are static are called by other classes using the class name of which it is a content followed by the method call statement.

Comments

Post a Comment

Popular posts from this blog

Patriot notes

The Patriot: About the poem The Patriot is a dramatic monologue written by the renowned English poet and playwright Robert Browning. He is well known for his dramatic monologues and is widely celebrated as one of the foremost poets of the Victorian era. In this poem, Browning talks about Politics, Patriotism, Religious faith, and the harsh reality of the leaders who are true to their sense of patriotism. It speaks about the sacrifice of such leaders who are misunderstood by the people. The speaker of the poem is a patriot. The poem is a monologue of this ‘patriot speaker’ who narrates his tale to us as he has been taken to the scaffold to be executed publicly for his ‘misdeeds’. He tells us of his situation: how he was once well loved by everyone, and how he is now despised by the same people. The patriot is innocent of having done any misdeeds, and it is only out of the misunderstanding of the people that he is being put to death. His death sentence is for the wrong reason, and alth

Bangle sellers

The Bangle Sellers Sarojini Naidu Extract 1:        Bangle sellers are we who bear Our shining loads to the temple fair…. Q.1. What is being referred to as ‘shining loads’? Who all are its prospective buyers? Ans: The shining bangles that are being carried by the bangle sellers to the temple fair for sale are called the ‘shining loads’. The prospective buyers of these bangles are the women of every age group. Q.2. Why does the bangle sellers choose to sell their bangles at the temple fair? Ans: The temple fair is a place which is visited by women of all age groups. Therefore, the bangle sellers choose to sell their bangles to the ‘happy daughters and happy wives’ at the temple fair. Q.3. Which figure of speech has been used in the line, “Rainbow-tinted circles of light”?Explain how is this related to the happiness of daughters and wives? Ans: The figure of speech used here is metaphor as the multi-hued bangles are compared with the radiant lives of happy daughters and h

The first world war icse notes

KINDLY READ THE TEXT BOOK ALSO (Total History book ) Q1. When did the First World War break out? Ans. The First World War broke out in the year 1914. Q2. Why is the war fought between 1914 and 1918 called the First World War? Ans. 1. It was fought on a worldwide scale and affected almost all the countries of the world. 2. Because of the unprecedented extent of its spread, impact and damage and its total nature, it is known as the First World War. Q3. Give the meaning of Nationalism. Ans. It refers to a sense of unity felt by the people ,who share a common history, language and culture. Q4. How was aggressive nationalism a cause for the First World War? Ans. 1. Aggressive nationalism meant love for one’s own country and hatred of the other countries. 2. Each nation thought about its own national interests and did not care for the interests of the other nations. 3. For example, France wanted to get back its provinces of Alsace and Lorraine from Germany. 4. Italy wante