0% found this document useful (0 votes)
3 views

Fundamentals of Java MS

This document is a revision worksheet for Grade VIII students on the fundamentals of Java programming. It includes multiple-choice questions, fill-in-the-blanks, true/false statements, and short and long answer questions covering key concepts such as variables, object-oriented programming, operators, and encapsulation. The worksheet aims to assess students' understanding of Java programming fundamentals.

Uploaded by

ashleyplaysszz
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Fundamentals of Java MS

This document is a revision worksheet for Grade VIII students on the fundamentals of Java programming. It includes multiple-choice questions, fill-in-the-blanks, true/false statements, and short and long answer questions covering key concepts such as variables, object-oriented programming, operators, and encapsulation. The worksheet aims to assess students' understanding of Java programming fundamentals.

Uploaded by

ashleyplaysszz
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Name Grade: VIII

Computer
Revision Worksheet 3(Fundamentals of Java)

CHOOSE THE CORRECT OPTION

1. A _____________________________is a named location in the memory, which stores data


temporarily.
A ) Identifier B ) Keyword C ) Variable

2. What does OOP stand for?


A ) Object-Oriented Programming B ) Object-Oriented Procedure C ) Object-Origin Program

3. Which of the following feature is used to manage the complexity of the system?
A ) Abstraction B ) Polymorphism C ) Encapsulation

4. Which of the following is not an example of the data type?


A ) public B ) int C ) float

5. The _____________________________compare the result of the relational expressions and


return either true or false.
A ) Unary Operators B ) Arithmetic Operators C ) Relational Operators

6. Which symbol is used to combine two or more items in a single line?


A)?B)+C)!

FILL IN THE BLANKS

1. Java programming is an _____________________________language.


A ) OBJECT-ORIENTED PROGRAMMING

2. _____________________________is the technique of binding both data and functions


together.
A ) ENCAPSULATION
3. A _____________________________is a blueprint that defines data and functions common
to all the objects.
A ) CLASS

4. The smallest meaningful element of a Java program is called a . .


A ) TOKEN

5. The _____________________________operator is used to assign a value to a


variable/constant.
A ) ASSIGNMENT

TRUE-FALSE

1. A variable name always starts with a digit.


A ) True B ) False

2. Constants mean the fixed values that do not change during the execution of a program.
A ) True B ) False

3. The main( ) function indicates that the execution of the Java program will begin from this
point.
A ) True B ) False

4. The keywords can be used as identifiers.


A ) True B ) False

5. Inheritance is a feature using which an object in one class acquires the properties of another
class.
A ) True B ) False

6. Binary operators work on single variable or constant.


A ) True B ) False

SHORT ANSWER

1. Riya has written a program in BlueJ and compiled it successfully. Help her execute the
program.
A ) TO EXECUTE THE PROGRAM, RIGHT-CLICK ON THE CLASS ICON. SELECT VOID MAIN
(STRING[ ]ARGS) OPTION FROM THE POP-UP MENU.
2. Manisha wants to calculate the average of the three subjects while writing a program. Which
operator should she use to write the expression?
A ) ARITHMETIC OPERATOR
3. State the Java concept that is implemented through:
i) A superclass and a subclass
A) INHERITANCE
ii) The act of representing essential features without including background details.
A) ENCAPSULATION

LONG ANSWER

1. Define objects. Give a real-life example to the explain objects along with their attributes and
behaviour.
A ) OBJECTS ARE REAL WORLD ENTITIES OR ITEMS. FOR EXAMPLE, A PEN IS AN OBJECT. ITS
ATTRIBUTES ARE BRAND NAME, MODEL, COLOUR, PRICE, ETC., AND ITS BEHAVIOUR
(FUNCTION) IS WRITING.
2. What do you understand by the term Polymorphism?
A ) THE WORD POLYMORPHISM MEANS ??MANY FORMS??. POLYMORPHISM HELPS THE
PROGRAMMER TO USE THE SAME FUNCTION NAME FOR MORE THAN ONE PURPOSE.
3. What are operators?
A ) OPERATORS ARE THE SPECIAL SYMBOLS THAT ARE USED TO PERFORM CALCULATIONS.
THEY ARE APPLIED TO THE VARIABLES AND CONSTANTS TO FORM AN EXPRESSION.
4. Distinguish between variables and keywords.
A ) A VARIABLE IS A NAMED LOCATION IN THE MEMORY, WHICH STORES DATA TEMPORARILY.
A VARIABLE IS ASSIGNED WITH A UNIQUE NAME. THE NAME IS A SEQUENCE OF LETTERS
AND DIGITS, BUT FIRST CHARACTER ALWAYS STARTS WITH A LETTER OR UNDERSCORE.
KEYWORDS ARE THE RESERVED WORDS OF A JAVA PROGRAM WITH SOME SPECIAL
MEANING, AND CAN BE USED FOR THAT PURPOSE ONLY. THE KEYWORDS CANNOT BE USED
AS VARIABLE NAMES.
5. Describe the different data types available in Java.
A ) TO UTILISE THE MAXIMUM AMOUNT OF MEMORY, JAVA PROVIDES DIFFERENT DATA
TYPES, SUCH AS INT, FLOAT, DOUBLE, CHAR AND BOOLEAN.
6. Distinguish between the relational and logical operators.
A ) RELATIONAL OPERATORS ARE USED TO COMPARE TWO VARIABLES WHEREAS LOGICAL
OPERATORS ARE USED TO COMPARE THE RESULT OF THE RELATIONAL EXPRESSIONS.
7. Describe the abstraction feature of OOP with an example.
A ) ABSTRACTION IS A VERY IMPORTANT FEATURE OF THE OBJECT-ORIENTED
PROGRAMMING. IT IS USED TO MANAGE THE COMPLEXITY OF THE SYSTEM I.E., IT PROVIDES
ONLY THE ESSENTIAL FEATURES OF THE SYSTEM TO THE USER AND HIDES ALL THE COMPLEX
PROCESSES.
8. What is precedence of operators?
A ) WHEN AN EXPRESSION CONTAINS MORE THAN ONE OPERATOR, IT EVALUATES
ACCORDING TO THE PRECEDENCE OF OPERATORS. A PRECEDENCE OF AN OPERATOR DEPICTS
THE ORDER IN WHICH THE DIFFERENT OPERATORS IN AN EXPRESSION ARE EVALUATED.
9. Distinguish between class and object
CLASS OBJECT
GROUP OF OBJECTS OF SAME KIND. REAL WORLD ENTITIES.
2 ASPECTS VARIABLES AND FUNCTIONS. 2 ASPECTS STATE THEM BEHAVIOUR.
CLASSES IS AN OBJECT FACTORY. IT IS A INSTANCE OF A CLASS.
BLUEPRINT TO, CREATE AN OBJECT.
10. Distinguish between POP and OOP

11. What is Abstraction


IT IS USED TO MANAGE THE COMPLEXITY OF THE SYSTEM, THAT IS, IT PROVIDES ONLY THE
ESSENTIAL FEATURES OF THE SYSTEM TO THE USER AND HIDES ALL THE COMPLEX PROCESS.
FOR EXAMPLE, AN ATM MACHINE, ONLY A USER HAS THE RIGHT TO INTERACT WITH THE
INTERFACE USING THE PROVIDED TOOLS. HE HAS NO IDEA ABOUT THE PROCESSES RUNNING
IN THE BACKGROUND AND THE FUNCTIONS INTERACTING WITH EACH OTHER.
12. With an example explain inheritance
INHERITANCE IS THE FEATURE USING WHICH AN OBJECT IN ONE CLASS ACQUIRES THE
PROPERTY AND BEHAVIOUR OF OBJECTS OF ANOTHER CLASS, WHICH MEANS YOU CAN
CREATE NEW CLASSES THAT ARE BUILT UPON EXISTING CLASS AND CAN REUSE THE
METHODS AND FIELDS OF THE PARENT CLASS.
A CLASS OF BIRDS CAN BE BROADLY CLASSIFIED AS FLYING BIRDS AND NON FLYING BIRDS.
THE PRINCIPLE BEHIND THE SORT OF CLASSIFICATION IS THAT EACH DERIVED CLASS SHARES
THE COMMON CHARACTERISTICS WITH THE CLASS FROM WHICH IT IS DERIVED.
13. Define
A)encapsulation
ENCAPSULATION IS THE TECHNIQUE OF BINDING BOTH DATA AND FUNCTIONS TOGETHER TO
KEEP THEM SAFE FROM ANY UNAUTHORISED ACCESS AND MISUSE. IT ENSURES THAT A
USER CANNOT ACCESS THE DATA WITHOUT PROPER AUTHORIZATION. IT ALSO ENSURES
THAT THE USER CAN HAVE ACCESS ONLY TO THOSE FUNCTIONS FOR WHICH HE IS
AUTHORISED, WHILE THE OTHER FUNCTIONS REMAIN UNAFFECTED. FOR EXAMPLE,
FUNCTION OF AN ATM.
B)Tokens
THE SMALLEST ELEMENT OF A JAVA PROGRAM IS CALLED A TOKEN. THESE ARE THE BASIC
BUILDING BLOCKS WHICH CAN BE PUT TOGETHER TO CONSTRUCT A PROGRAM. A TOKEN
CAN BE A RESERVED WORD(INT OR WHILE), AN IDENTIFIER(SUM OR I), A CONSTANT(5 OR
‘F’), A PUNCTUATOR({ OR ;) OR AN OPERATOR(+ OR %).
C)Keywords
KEYWORDS ARE THE RESERVED WORDS OF A JAVA PROGRAMM WITH SOME SPECIAL
MEANING AND CAN USED FOR THAT PURPOSE ONLY. THE KEYWORDS CANNOT BE USED AS
IDENTIFIER THAT IS VARIABLE NAME, CLASS NAME OR A METHOD NAME.
14. What are the rules for naming Identifiers
• AN IDENTIFIER MAY BE COMPOSED OF ANY COMBINATION OF LETTERS,_ OR $
• AN IDENTIFIER ALWAYS STARTS WITH A LETTER OR _
• AN IDENTIFIER SHOULD NOT BE A KEYWORD.
• AN IDENTIFIER CAN BE OF ANY LENGTH.
15. Explain types of constants with example
CONSTANT MEANS THE FIXED VALUES THAT DO NOT CHANGE DURING THE EXECUTION OF A
PROGRAM. CONSTANTS ARE ALSO REFERRED TO AS LITERALS..
NUMERIC CONSTANTS.
THESE VALUES CAN BE INTEGER CONSTANTS OR REAL CONSTANT SUCH AS 12 -, 5, 1.55,
0.756.
CHARACTER CONSTANTS.
THESE CONSTANTS CAN BE A SINGLE CHARACTER CONSTANT OR A STRING (MULTI
CHARACTER) CONSTANTS.
A SINGLE CHARACTER CONSTANT IS ENCLOSED IN SINGLE QUOTES, FOR EXAMPLE ‘P’,’4’, ‘S’
WHEREAS A STRING CONSTANT IS A SEQUENCE OF CHARACTERS ENCLOSED WITH A DOUBLE
QUOTES EXAMPLE “WELCOME” , “JAVA PC.”
16. Name types of Operators
• ARITHMETIC OPERATOR:- ADDITION (+), SUBTRACTION (-), MULTIPLICATION (*),
MODULUS(%) AND DIVISION (/)..
• RELATIONAL OPERATORS:- <, >, <=, >=, ==, !=
• LOGICAL OPERATOR:- AND, OR, NOT
• INCREMENT AND DECREMENT OPERATOR:- ++ AND --
• ASSIGNMENT OPERATOR.:- +=, -=, *=, /=, %=

You might also like