Presentation is loading. Please wait.

Presentation is loading. Please wait.

Question 01 Which of the following can be stored by a simple or primitive data type? (a)Only 1 single value (b)Only Attributes (c)Only Methods (d)Both.

Similar presentations


Presentation on theme: "Question 01 Which of the following can be stored by a simple or primitive data type? (a)Only 1 single value (b)Only Attributes (c)Only Methods (d)Both."— Presentation transcript:

1 Question 01 Which of the following can be stored by a simple or primitive data type? (a)Only 1 single value (b)Only Attributes (c)Only Methods (d)Both Attributes and Methods

2 Question 02 Which of the following can be stored by a an object? (a)Only 1 single value (b)Only Attributes (c)Only Methods (d)Both Attributes and Methods

3 Question 03 What does a user-defined method require? (a)A heading (b)A set of braces { } (c)A body of program statements (d)All of the above

4 Question 04 Which of the following can be an actual parameter? (a)a constant (b)a variables (c)an expression with constants only (d)an expression with variables and constants (e)a return method call (f)All of the above

5 Question 05 Which of the following is true? (a)A method can be BOTH a void method and a class method. (b)A method can be BOTH a void method and an object method. (c)A method can be BOTH a return method and a class method. (d)A method can be BOTH a return method and an object method. (e)All of the above

6 Question 06 Modular programming (a)places statements that achieve a common purpose into its own module. (b)specifies "one task, one module". (c)is an important programming design concept. (d)all of the above.

7 Question 07 Using the name of the class is _______ if you are calling a method from the same class. (a)optional (b)required (c)forbidden

8 Question 08 Using the name of the class is _______ if you are calling a method from a different class. (a)optional (b)required (c)forbidden

9 Question 09 True or False: Programs should be written by placing all of the program statements in the main or paint methods. (a) True (b) False

10 Question 10 True or False: In a well-designed program, the main or paint method will look like an outline. (a) True (b) False

11 Question 11 Assume number is a double. What type of parameter is number in this statement? result = Math.sqrt(number); (a)actual parameter (b)formal parameter (c)class parameter

12 Question 12 What type of parameters are in this method heading? public static void sum(int n1, int n2) (a)actual parameters (b)formal parameters (c)class parameters

13 Question 13 The Track Relay analogies are used to explain (a)modular programming. (b)object oriented programming. (c)method headings. (d)parameter passing.

14 Question 14 True or False: Calling the methods that you have created is done in the same way as calling the built-in Java methods. (a) True (b) False

15 Question 15 Any method that needs to display graphical output requires what? (a)an int variable (b)a double variable (c)a char variable (d)a DecimalFormat object (e)the Graphics object g

16 Question 16 If you choose to break up a large graphics program into multiple methods, you need to make sure that you pass ____________________ to ALL of these methods. (a)an int variable (b)a double variable (c)a char variable (d)a DecimalFormat object (e)the Graphics object g

17 Question 17 Assume you are in the main method of the DutchSolitaire class. You wish to call the getHighScore method of the Game class. Which of the following does this properly? (a)getHighScore(); (b)Game.getHighScore(); (c)DutchSolitaire.getHighScore(); (d)getHighScore.Game(); (e)getHighScore.DutchSolitaire(); (f)Both choices A and B

18 Question 18 Assume you are in the main method of the Game class. You wish to call the getHighScore method which is also in the Game class. Which of the following does this properly? (a)getHighScore(); (b)Game.getHighScore(); (c)DutchSolitaire.getHighScore(); (d)getHighScore.Game(); (e)getHighScore.DutchSolitaire(); (f)Both choices A and B

19 Question 19 Which of the following headings has a compile error? (a)public static void qwerty (int x,y) (b)public static void qwerty (int x, int y) (c)public static void qwerty (String x, int y, double z) (d)public static void qwerty (char c); (e)All of the above

20 Question 20 True or False: All methods require parameters. (a) True (b) False

21 Extra Credit Which of the following is NOT one of the ways that actual parameters and formal parameters must always match? (a)The number of actual parameters must match the number of formal parameters. (b)The data types of the actual parameters must match the data types of the formal parameters. (c)The identifiers of the actual parameters must match the identifiers of the formal parameters. (d)The sequence of the actual parameters must match the sequence of the formal parameters.


Download ppt "Question 01 Which of the following can be stored by a simple or primitive data type? (a)Only 1 single value (b)Only Attributes (c)Only Methods (d)Both."

Similar presentations


Ads by Google