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

Slides:



Advertisements
Similar presentations
Continuation of chapter 6…. Nested while loop A while loop used within another while loop is called nested while loop. Q. An illustration to generate.
Advertisements

Loops –Do while Do While Reading for this Lecture, L&L, 5.7.
CSCI 160 Midterm Review Rasanjalee DM.
Fundamental Programming Structures in Java: Control Flow, Arrays and Vectors.
Classes  All code in a Java program is part of a class  A class has two purposes  Provide functions to do work for the programmer  Represent data.
Copyright © 2014, 2011 Pearson Education, Inc. 1 Active Learning Lecture Slides For use with Classroom Response Systems Chapter 3 Describing Categorical.
Chapter 7 User-Defined Methods. Chapter Objectives  Understand how methods are used in Java programming  Learn about standard (predefined) methods and.
Java Planning our Programs Flowcharts Arithmetic Operators.
10-Jun-15 Just Enough Java. Variables A variable is a “box” that holds data Every variable has a name Examples: name, age, address, isMarried Variables.
Introduction to Computers and Programming Introduction to Methods in Java.
BASIC JAVA. Hello World n // Hello world program public class MyFirstJavaProgram { public static void main(String args[]) { char c = 'H'; String s =
Computer Science A 1: 3/2. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated.
Programming Part 1 Armond R. Smith Zhenying Wu. Overview of this Class ● Transition from FTC -> FRC ● Using Your Resources ● Java Keywords o Data Types.
UNIT II Decision Making And Branching Decision Making And Looping
PreAP Computer Science Quiz
1 Identifiers  Identifiers are the words a programmer uses in a program  An identifier can be made up of letters, digits, the underscore character (
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 9 Clicker Questions September 29, 2009.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
Rhetorical Précis Quiz
The Java Programming Language
CSC204 – Programming I Lecture 4 August 28, 2002.
Chapter 4: Loops and Files
CIS 260: App Dev I. 2 Programs and Programming n Program  A sequence of steps designed to accomplish a task n Program design  A detailed _____ for implementing.
Lecture 3 Decisions (Conditionals). One of the essential features of computer programs is their ability to make decisions. Like a train that changes tracks.
An Introduction to Java – Part 1 Dylan Boltz. What is Java?  An object-oriented programming language  Developed and released by Sun in 1995  Designed.
CSCI 3328 Object Oriented Programming in C# Chapter 5: C# Control Statement – Part II – Exercises 1 Xiang Lian The University of Texas Rio Grande Valley.
Data Types and Operations On Data Objective To understand what data types are The need to study data types To differentiate between primitive types and.
Introduction to Java Lecture Notes 3. Variables l A variable is a name for a location in memory used to hold a value. In Java data declaration is identical.
Assignment An assignment statement changes the value of a variable The assignment operator is the = sign total = 55; Copyright © 2012 Pearson Education,
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
1 More data types Character and String –Non-numeric variables –Examples: char orange; String something; –orange and something are variable names –Note.
Take out a piece of paper and PEN. The quiz starts ONE minute after the tardy bell rings. You will have 45 – 90 seconds per question. Determine the output.
FOR LOOP WALK THROUGH public class NestedFor { public static void main(String [] args) { for (int i = 1; i
Clicker quiz 10/8/13 CSE 1102 Fall 2013 (E-30 reminder!)
Department of Computer Engineering Methods Computer Programming for International Engineers.
Midterm preview. double int = 2.0; True / FalseThe following is a syntactically correct variable declaration and assignment statement:
1 Advanced Programming Examples Output. Show the exact output produced by the following code segment. char[,] pic = new char[6,6]; for (int i = 0; i
Announcements Final Exam: TBD. Static Variables and Methods static means “in class” methods and variables static variable: one per class (not one per.
A Introduction to Computing II Lecture 1: Java Review Fall Session 2000.
Computer Science A 1. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated editor,
Session 2 Operators, Decisions and Loops. Objectives Operators Casting data Decision marking structures Loops break, continue, return.
Methods What is a method? Main Method the main method is where a stand alone Java program normally begins execution common compile error, trying.
Absolute zero is simply a linear extrapolation used to locate at point at which gasses reach zero pressure. A.True B.False.
Clicker quiz 9/17/13 CSE 1102 Fall // In Blob: public void mousePressed(MouseEvent e){ this.setFillColor(java.awt.Color.blue); } // in WinkingBlob.
Question 1 What can happen if you don’t close a File Stream when you are done with it? A)Nothing will happen since it will always close on its own B)The.
AP Computer Science DYRT Quiz
1 Lecture # 2. * Introducing Programming with an Example * Identifiers, Variables, and Constants * Primitive Data Types * Byte, short, int, long, float,
Today… Preparation for doing Assignment 1. Invoking methods overview. Conditionals and Loops. Winter 2016CMPE212 - Prof. McLeod1.
Introduction to Programming G50PRO University of Nottingham Unit 6 : Control Flow Statements 2 Paul Tennent
Chapter 7 Control Structures. Java has very flexible three looping mechanisms. You can use one of the following three loops:  while Loop  do...while.
When you write to a file, what happens to the content that’s already there? A.The new content replaces the original content. B.The new content goes at.
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.
CS0007: Introduction to Computer Programming
Exercise Java programming
using System; namespace Demo01 { class Program
Something about Java Introduction to Problem Solving and Programming 1.
Chapter 2.
Computing Adjusted Quiz Total Score
An Introduction to Java – Part I, language basics
The Boolean (logical) data type boolean
Propositional Equivalences Rosen 5th and 6th Editions section 1.2
Take out a piece of paper and PEN.
class PrintOnetoTen { public static void main(String args[]) {
Java for Beginners University Greenwich Computing At School DASCO
CSE 142 Lecture Notes Defining New Types of Objects, cont'd.
Multiple Files Revisited
Take out a piece of paper and PEN.
Agenda Remarks about last homeworks Class methods(static methods)
Lecture 22: Number Systems
Pre-AP® Computer Science Quiz
Presentation transcript:

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

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

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

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

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

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

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

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

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

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 = '?';.... }

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 = '?';.... }

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 = '?';.... }

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 = '?';.... }

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

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 = '?';.... }

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

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

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.

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

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

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