Wednesday, November 26, 2014

ITKT(Computer) - Cycle Test 3 - Chapter 9

Chapter 9 – Introduction to Java
Answer the following questions.
1)  What is OOP?
OOP’s means Object-Oriented Programming.
OOP’s is a methodology that focuses on data items rather than processes.
It’s bridge between problem in the real world and solution in computer programming.
In this a programmer can focus on the objects that naturally make up a system, rather than its procedure.
                                      Or
Object means a real word entity such as pen, chair, table etc. 
Object-Oriented Programming is a methodology to design a program using classes and objects.
It simplifies the software development and maintenance by providing some concepts like
It’s based on
1) Object     2) Class       3) Encapsulation     4) Inheritance
2)  What is Object?
Object means collection of data and the procedure or function
which work on that data.
The procedures are called methods.
There are two main characteristics of an object
              Or
Object means a real word entity such as pen, chair, table etc
1) State/Attributes
2) Behaviour/Actions.
Example: Car,Pencil,etc..
3)  What is Class?
A Class defines a type of object.
It defines the variables and methods common to all object of a certain kind
It also describes the rules by which objects behave.
Or
A class is a collection of objects of similar types.
Example:  mango, apple, and orange are members of the class fruit.
Class is user-defined data types and behaves like the built –in types of language.
4)  What is Encapsulation?
Encapsulation is the process of keeping the data of an object along with its methods and hiding it from the outside world.
Or
‘‘ The  wrapping  up  of  data  and methods  into  a  single  unit (called class) is  known  as Encapsulation ’’
Example:
Common illustrations:
Ø  The internal organs, muscles, bones etc. of human body is encapsulated with Skin.
Ø    A chocolate is encapsulated with a wrapper.
In Encapsulation
An object is composed of a public and private section.
Public section is the one that can be accessed from outside the object.
Private section is the one that can’t be accessed from outside the object.

5)  What is Inheritance?

Sub Class

Super Class
Inheritance is the process of creating a new class with the characteristics of an existing class along with additional characteristics unique to the new class.
Or
“It  is  the  process  by  which  one  object  acquires  the  properties  (attributes  & actions)  of  another  object”.

6)  Steps to create a New Project in BlueJ?
1)    Click on Project menu -> select New Project option
2)   Select location and specify the name of project. Like “StudentProject”.
and then click on Create button.
3)   Then you can see Project window & one README.TXT file.
4)   Click on README.TXT and write down the following details:
a.    PROJECT TITLE:            d. PURPOSE OF PROJECT:
b.    VERSION or DATE:        e. HOW TO START THIS PROJECT:
c.    AUTHORS:                     f. USER INSTRUCTIONS:
7)  Steps to create a class in BlueJ?
After creating a project to create a class follow these steps:
1)    Click on New Class
2)   Then write down class name & select the type of class.
3)   Now right click on that class select Open Editor and after removing given code write your own code.
4)   Then compile that class. If it is done successfully the slanting bar s will disappear else it gives you an error.
8)  What is Compiler?
Compiler is a process of transforming source code into object code for execution.
9)  What is Variables? Types of variable in Java.
A variable refers to the memory location that holds values like:
Number, Texts,  etc.  in computer memory.
There are three types of variables in java:
1)  Instance Variable - 
It is related to objects of a class and each object of the same class can have different instance variables.
2)  Class Variable - 
It is related to class and not to particular objects of a class.
It is define with static keyword and shared by all object of that class.
It is like global variable which are same for all objects of the class.
3)  Local Variable - 
The variable which are defined in a method or block of code.

10)      State the rules for naming a variable in java.
i)     Uppercase and lowercase letters are different.
ii)   No limitation to the number of letters in a variable name
iii) Digits are allowed but the first letter must be an alphabet.
iv)  Only ‘$’ and ‘_’ are allowed in a variable ‘$’ cannot appear in the beginning.
v)    Spaces are not allowed.



11)      What is Data Type?
The type of value that a variable can hold is called data type.
When we declare a variable we need to specify the type of value it will hold along with the name of variable. Like..











12)      Give Example: How to declare and initialize the variable in java?
Example of declaring the variable:

int Num;   

here variable name is Num and the data type is int so it can store integer value.
Some more example-

float num;
char Name;
double Math;





Example of initializing the variable:
The value can be given to the variable when they created. Like.

float Eng=89;
int age=13;
char Alpha=’A’;

13)      How to handle flow of a data?
Ø  System.out.println() – used to display the output on the computer screen.
Ø  System – predefined class to provide access to the system,
Ø  out – it is output stream
Ø  println() – function to display the text(string)  passed inside brackets
Ø  Ex.   System.out.println( “Welcome to Java”)
Ø  Ex.   int A=10;
Ø  System.out.println(“value of A is : ”+A)

Note:-also refer page no 99 to 101 from text book.

Fill in the blanks
1.     int A; A occupies ____2____bytes.
2.    float B; B occupies ____4___bytes.
3.    double Num; Num occupies ___8____ bytes.
4.    char alpha; alpha occupies ____2______bytes.
5.    The variable which are defined in a method or block of code is called       Local Variable.
6.    The type of value that a variable can hold is called data type.
7.    println() is a function to display the text(string)  passed inside brackets.
8.    Compiler is a process of transforming source code into object code for execution.
9.    A BlueJ project is a directory containing raw Java source code files, compiled java files and some additional files.



Note  :-

also refer text book, text book exercise from cd &  worksheet.
chapter 7 material will be uploaded soon.



Computer syllabus for Cycle Test 3 :-

Chapter 7: Understanding CorelDraw
Chapter 9: Introduction to Java



No comments:

Post a Comment