Presentation is loading. Please wait.

Presentation is loading. Please wait.

Question 01 Return methods always (a)calculate some mathematical formula. (b)display a value. (c)return a value. (d)use numerical values.

Similar presentations


Presentation on theme: "Question 01 Return methods always (a)calculate some mathematical formula. (b)display a value. (c)return a value. (d)use numerical values."— Presentation transcript:

1 Question 01 Return methods always (a)calculate some mathematical formula. (b)display a value. (c)return a value. (d)use numerical values.

2 Question 02 What type of method is written below? public static void add(int n1, int n2) { System.out.println(n1 + n2); } (a)return method (b)add method (c)void method (d)print method

3 Question 03 What type of method is written below? public static int add(int n1, int n2) { return n1 + n2; } (a)return method (b)add method (c)void method (d)print method

4 Question 04 What type of method is the main method? (a)return method (b)add method (c)void method (d)print method

5 Question 05 Java’s Math class contains __________ methods. (a)void class (b)void object (c)return class (d)return object

6 Question 06 The graphics methods of the Expo class are __________ methods. (a)void class (b)void object (c)return class (d)return object

7 Question 07 What is wrong with this program segment? public static void main(String args[]) {int x=5;int y=7;char c=‘Q’;x--;y*=2;c++;if (x==y)System.out.println(“Hello”);else c--; if(c==‘P’){x=y-7;c=‘Z’;} else{y=x;c=‘A’;}} (a)There is no readable program format. (b)The variable identifiers make no sense. (c)All the program statements are in one module. (d)All of the above

8 Question 08 Which of the following is an example of a good self-commenting identifier? (a)qwerty (b)k (c)netPay (d)public

9 Question 09 Which of the following is/are true about designing a program? (a)Use self-commenting identifiers. (b)Use consistent indentation style. (c)Don't place many program statements in the main method. (d)Specific tasks should be placed in modules called methods. (e)Similar methods accessing the same data should be placed in their own class. (f)All of the above

10 Question 10 What kind of variable is x? (a)local variable (b)class variable (c)final variable public class Quiz746 { static String z = "Bob"; public static void main(String args[]) { int x = 7;.... } public static void qwerty() { char y = '?';.... }

11 Question 11 What kind of variable is y? (a)local variable (b)class variable (c)final variable public class Quiz746 { static String z = "Bob"; public static void main(String args[]) { int x = 7;.... } public static void qwerty() { char y = '?';.... }

12 Question 12 What kind of variable is z? (a)local variable (b)class variable (c)final variable public class Quiz746 { static String z = "Bob"; public static void main(String args[]) { int x = 7;.... } public static void qwerty() { char y = '?';.... }

13 Question 13 Where can the variable x be used? (a)the main method (b)the qwerty method (c)entire Quiz746 class public class Quiz746 { static String z = "Bob"; public static void main(String args[]) { int x = 7;.... } public static void qwerty() { char y = '?';.... }

14 Question 14 public class Quiz746 { static String z; public static void main(String args[]) { int x = 7;.... } public static void qwerty() { char y = '?';.... } Where can the variable y be used? (a)the main method (b)the qwerty method (c)entire Quiz746 class

15 Question 15 Where can the variable z be used? (a)the main method (b)the qwerty method (c)entire Quiz746 class public class Quiz746 { static String z; public static void main(String args[]) { int x = 7;.... } public static void qwerty() { char y = '?';.... }

16 Question 16 True or False: A method can be used to create another method. (a)True (b)False

17 Question 17 True or False: Methods can only be called from the main method. (a)True (b)False

18 Question 18 When a program has multiple classes, which is called the Driving Class? (a)The class with the same name as the file. (b)The class with the most methods. (c)The class with the least number of methods. (d)The class with the main or paint method.

19 Question 19 Which of these is a synonym for Class Variable? (a)attribute (b)final variable (c)local variable (d)parameter

20 Question 20 What does breaking a program up into different classes and methods do for the program? (a)It makes the program easier to read. (b)It makes the program easier to write. (c)It makes the program easier to understand. (d)It makes the program more organized. (e)All of the above

21 Extra Credit Expo.enterInt, Expo.enterDouble, Expo.enterString and Expo.enterChar are __________ methods. (a)void class (b)void object (c)return class (d)return object


Download ppt "Question 01 Return methods always (a)calculate some mathematical formula. (b)display a value. (c)return a value. (d)use numerical values."

Similar presentations


Ads by Google