ICSE Computer Question Answer

ICSE Computer Question Answer

Q. a) State the difference between token and identifier, variable.
Ans. A token is the smallest individual unit in a program for e.g.: Keyword, Identifiers, Literals etc. where as an identifier is the name given to different parts of a program e.g. variable, functions, classes etc.
Variable: A memory location that stores a value is known as variable. E.g. int a;
    b) What is variable. Give an example.
Ans. Place holder of data in computer memory. E.g. Int a,b,c;
Q. Define Byte code and JVM.
Ans. Byte code is the compiled format for Java programs. Once a Java program has been converted to byte code, it can be transferred across a network and executed by Java Virtual Machine (JVM). Byte code files generally have a .class extension
Ans: JVM is a platform-independent execution environment that converts Java byte code into machine language and executes it. Most programming languages compile source code directly into machine code that is designed to run on a specific microprocessor architecture or operating system, such as Windows or UNIX. A JVM -- a machine within a machine -- mimics a real Java processor, enabling Java byte code to be executed as actions or operating system calls on any processor regardless of the operating system.
Q. Example the term Object and Class using an example. 
Ans. Object: An instance of a class called Object. Table is an instance of class Furniture.
Class: Blue print of an object is called Class. Example, mango, apple and orange are members of the class fruit.
Q. Name four OOP’S principles.
Ans. Abstraction, Encapsulation, Polymorphism, Inheritance
Abstraction: Abstraction refers to the act of representating essential features without including the background details or explanations.
Encapsulation: The wrapping up of data and methods into a single unit is called Encapsulation.
Polymorphism: polymorphism refers to a programming language's ability to process objects differently depending on their data type or class. More specifically, it is the ability to redefine methods for derived classes. For example, given a base class shape, polymorphism enables the programmer to define different area methods for any number of derived classes, such as circles, rectangles and triangles. No matter what shape an object is, applying the area method to it will return the correct results.
Inheritance: Inheritance is the process by which objects of one class acquire the properties of objects of anther class. Different kinds of objects often have a certain amount in common with each other. Mountain bikes, road bikes, and tandem bikes, for example, all share the characteristics of bicycles (current speed, current pedal cadence, current gear). Yet each also defines additional features that make them different: tandem bicycles have two seats and two sets of handlebars; road bikes have drop handlebars; some mountain bikes have an additional chain ring, giving them a lower gear ratio.
Q. Mention any two attributes required for class declaration.
Ans: Variables and function or state and behaviour.
Q. Differentiate between base and derived class.
The base class is a class whose properties will be inherited and the derived class is a class which inherits the base class. E.g. Of base class is Super and derived class is sub.
Q. What is data types?
A data type in a programming language is a set of data with values having predefined characteristics. Examples of data types are: int, float,char etc.
The following chart summarizes the default values for the above data types.
Data Type
Default Value (for fields)
byte
0
short
0
int
0
long
0L
float
0.0f
double
0.0d
char
'\u0000'
String (or any object)  
null
boolean
false



SHARE THIS
Previous Post
Next Post