Skip to main content

Introduction to Java Class 8 Computer

Introduction to Java
Fill in the blanks with the correct words.
1. The int data type takes four bytes for storage.
2. ‘A’ is a character constant.
3. float a = 45.34; is a/an initialization statement.
4. The output of 20 % 6 in Java will be 2.
5. The do…while is an exit-controlled loop.

Write T for the true statement and F for the false one. Correct the false statement(s).
1. In Java, a class is a capsule of data members and member functions. (T)
2. To run a Java program, double-click the compiled class. (F) (Right-click the class and click void main() to execute it)
3. A variable name can start with a digit. (F) (A variable name can start with a letter or an underscore or a dollar sign)
4. The selection statements in Java are if and switch. (T)
5. The while loop is executed at least once. (F) (The do…while loop is executed at least once)

Choose the correct option.
1. Which data type is used to store a whole number?
a. float b. int c. double d. long double
2. Which of these is an invalid String constant?
a. “9” b. “Hello” c. ‘9’ d. “*****”
3. In the switch statement, if the value does not match any case label, then
a. Statements after break are executed
b. Statements in the default case are executed
c. An error occurs
d. None of these
4. Which of the following is a conditional statement?
a. for b. while c. if d. do…while
5. Which of these is not a valid initialization?
a. int a = 12; b. float b = 34.6 c. char a = ‘A’; d. String S = ‘Hello!’;

Answer the following.
1. What do you understand by object-oriented programming?
Object-oriented programming is a different and modern approach to programming that is based on the fundamental concept of objects.

2. What is a class in Java? What is it composed of?
A class is a collection of similar objects and acts as a data type for those objects. It is composed of data members and member functions.

3. What is a method? Explain its general format.
A method is a set of code that can be used at different points in the program.

1
2
3
<access specifier> <return type> <method name> (formal parameter list){
    //body of the method
}
The access specifier can be public, protected, private or friendly.
The return type is the data type of the value returned by the method.
The method name is the name of the method.
The formal parameter list is the list of variables separated by commas that receive values when a method is called by the object.

4. What do you understand by data type? List the data types in Java.
Data type means the type of value that a variable can store. Following are the list of data types: byte, short, int long, char, float, double, boolean and String.

5. Name the three looping statements in Java. Write their syntax.
The three looping statements in Java are while, do…while, and for.

1
2
3
4
5
6
7
8
9
10
11
while(condition){
    statement(s);
}
 
do{
    statement(s);
}while(condition);
 
for(initialization; condition; update){
    statement(s);
}

Comments

Popular posts from this blog

Tenses: Correct Form of the Verb Exercises: ICSE English Language

Tenses: Correct Form of the Verb Exercises: ICSE English Language ** [For other Important Links related to English Language, click here ๐Ÿ‘‡ https://english-language-important-links ( It is advisable to first try and solve the answers on your own, write it down in your copies and once you're done with all the questions, check from the solutions and rectify your mistakes. This practice enables you to learn from your mistakes and helps your brain retain a vivid memory and enhances your ability of language acquisition)  In the following passage, fill in each of the numbered blanks with the correct form of the word given in brackets. Do not copy the passage, but write in correct serial order the word or phrase appropriate to the blank space. (answers below). Exercise I (0) disappeared The sun (0)_______ (disappear) behind the clouds and the sky turned grey. The wind (1)____(pick) up and a few drops of rain fell on the old tin roof. Jose (2)_____(run) inside and (3)_____(cl

ICSE Mathematics Specimen Paper 2023 with Solutions(/ Answer Key)

ICSE Mathematics Specimen Paper 2023 with Solutions(/ Answer Key) Part A: Question Paper Part B: Answer Key Part A: Question Paper:- For detailed video explanation of these sums and sums from other chapters in your syllabus, click here ๐Ÿ‘‰  Chapter wise Video Explanations of most important sums from each chapter Part B: Answer Key:-  (Scroll Below the next section on other important links for rest of the pages) [ **If you found this useful, do check the 2023 specimen papers of other subjects along with their Solutions by clicking here:  https://novakidhs.blogspot.com/p/icse-specimen-papers-2023-with.html ** For Questions and Answers, Solved Test Papers , Previous Years paper scanner and much more curated study materials on all the subjects of the ICSE syllabus, click here ๐Ÿ‘‡ https://novakidhs.blogspot.com/p/icse-class-10a

Do as Directed: ICSE English Language

ICSE English Language: Do as Directed: Exercises with Answers for Practice  ** [If you're unable to solve some of these questions or feel the need to revise the basics and rules, click here for an easy-to-follow guideline๐Ÿ‘‡ https://transformation-of-sentences-complete-guide ( It is advisable to first try and solve the answers on your own, write it down in your copies and once you're done with all the questions, check from the solutions and rectify your mistakes. This practice enables you to learn from your mistakes and helps your brain retain a vivid memory and enhances your ability of language acquisition)  1. It is probable that he will never come back. (Begin: In …) 2. He said to me, ‘Where are you going?’ (Begin: He asked me …) 3. As soon as the chief guest had arrived, the play began. (Begin: No sooner ….) 4. I was surprised at his behaviour. (Begin: His …) 5. He will certainly succeed. (Begin: He is …) 6. He is the best student in the class. (Use better instea