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.

Slides:



Advertisements
Similar presentations
Introduction to C Programming
Advertisements

1.A computer game is an example of A.system software; B.a compiler; C.application software; D.hardware; E.none of the above. 2.JVM stands for: A.Java Virtual.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 6 Functions.
1 Focal Point and Images Light from a nearby object passes through a lens forming an image. Which of the following is true? a)The light is in focus at.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Sixth Edition Chapter 6: Functions by.
Java Programming: From Problem Analysis to Program Design, 4e Chapter 7 User-Defined Methods.
Lesson 6 Functions Also called Methods CS 1 Lesson 6 -- John Cole1.
Chapter 7: User-Defined Methods
Warm-Up: April 21 Write a loop (type of your choosing) that prints every 3 rd number between 10 and 50.
© 2007 Lawrenceville Press Slide 1 Chapter 7 Top-Down Development  Problem-solving approach  Breaking a task down into smaller subtasks  First level.
© The McGraw-Hill Companies, 2006 Chapter 4 Implementing methods.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 9 Clicker Questions September 29, 2009.
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 6 Functions.
Copyright © 2012 Pearson Education, Inc. Chapter 6: Functions.
PreAP Computer Science Quiz
Outline Character Strings Variables and Assignment Primitive Data Types Expressions Data Conversion Interactive Programs Graphics Applets Drawing Shapes.
 Pearson Education, Inc. All rights reserved Introduction to Java Applications.
Functions Modules in C++ are called functions and classes Functions are block of code separated from main() which do a certain task every C++ program must.
Functions Top-down design Breaking a complex problem into smaller parts that we can understand is a common practice. The process of subdividing a problem.
CMP-MX21: Lecture 4 Selections Steve Hordley. Overview 1. The if-else selection in JAVA 2. More useful JAVA operators 4. Other selection constructs in.
Loops (cont.). Loop Statements  while statement  do statement  for statement while ( condition ) statement; do { statement list; } while ( condition.
Assignment An assignment statement changes the value of a variable The assignment operator is the = sign total = 55; Copyright © 2012 Pearson Education,
Starting Out with Java: From Control Structures through Objects Fifth Edition by Tony Gaddis Chapter 5: Methods.
Procedural Programming Criteria: P2 Task: 1.2 Thomas Jazwinski.
KIC/Computer Programming & Problem Solving 1.  Introduction  Program Modules in C  Math Library Functions  Functions  Function Definitions  Function.
1 Methods Introduction to Methods Passing Arguments to a Method More About Local Variables Returning a Value from a Method Problem Solving with Methods.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 6 Functions.
Starting Out with C++ Early Objects ~~ 7 th Edition by Tony Gaddis, Judy Walters, Godfrey Muganda Modified for CMPS 1044 Midwestern State University 6-1.
1 Brief Version of Starting Out with C++, 4th Brief Edition Chapter 6 Functions.
CHAPTER 10 ARRAYS AND FUNCTIONS Prepared by: Lec. Ghader Kurdi.
CSE 201 – Elementary Computer Programming 1 Extra Exercises Sourceshttp://
Chapter Functions 6. Modular Programming 6.1 Modular Programming Modular programming: breaking a program up into smaller, manageable functions or modules.
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 6 Functions.
Functions Chapter 6. Modular Programming Modular programming: breaking a program up into smaller, manageable functions or modules Function: a collection.
Course Title Object Oriented Programming with C++ instructor ADEEL ANJUM Chapter No: 06 FUNCTIONS 1 BY ADEEL ANJUM (MSc-cs, CCNA,WEB DEVELOPER) 1.
1 ICS103 Programming in C Lecture 8: Functions I.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-1 Why Write Methods? Methods are commonly used to break a problem down.
PreAP Computer Science Quiz
Creating and Using Class Methods. Definition Class Object.
Methods Awesomeness!!!. Methods Methods give a name to a section of code Methods give a name to a section of code Methods have a number of important uses.
Midterm preview. double int = 2.0; True / FalseThe following is a syntactically correct variable declaration and assignment statement:
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 6: Functions.
FUNCTIONS. Midterm questions (1-10) review 1. Every line in a C program should end with a semicolon. 2. In C language lowercase letters are significant.
Classes - Intermediate
AP Java Ch. 4 Review Question 1  Java methods can return only primitive types (int, double, boolean, etc).
Lecture 4 – Function (Part 1) FTMK, UTeM – Sem /2014.
CPSC 233 Tutorial 5 February 9 th /10 th, Java Classes Each Java class contains a set of instance variables and methods Instance Variables: Type.
Methods What is a method? Main Method the main method is where a stand alone Java program normally begins execution common compile error, trying.
Chapter 6 Functions. 6-2 Topics 6.1 Modular Programming 6.2 Defining and Calling Functions 6.3 Function Prototypes 6.4 Sending Data into a Function 6.5.
Question 01 Return methods always (a)calculate some mathematical formula. (b)display a value. (c)return a value. (d)use numerical values.
1 Lecture # 2. * Introducing Programming with an Example * Identifiers, Variables, and Constants * Primitive Data Types * Byte, short, int, long, float,
 By the end of this section you should be able to: ◦ Differentiate between sequence, selection, and repetition structure. ◦ Differentiae between single,
Midterm preview.
Information and Computer Sciences University of Hawaii, Manoa
Functions + Overloading + Scope
Methods Additional Topics
Chapter 6: Functions Starting Out with C++ Early Objects Ninth Edition
Chapter 6 Methods: A Deeper Look
6 Chapter Functions.
Group Status Project Status.
Chap 1 Chap 2 Chap 3 Chap 5 Surprise Me
Take out a piece of paper and PEN.
Programs and Classes A program is made up from classes
Based on slides created by Bjarne Stroustrup & Tony Gaddis
Names of variables, functions, classes
Take out a piece of paper and PEN.
Standard Version of Starting Out with C++, 4th Edition
Presentation transcript:

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

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

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

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

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

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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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.