Exam 1 Prep. Dr. Demetrios Glinos University of Central Florida. COP3330 Object Oriented Programming

Similar documents
Introduction to Programming Using Java (98-388)

ECE 122 Engineering Problem Solving with Java

Computational Expression

CSCI 2010 Principles of Computer Science. Data and Expressions 08/09/2013 CSCI

Full file at

Reviewing for the Midterm Covers chapters 1 to 5, 7 to 9. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013

Chapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics

Full file at

Discover how to get up and running with the Java Development Environment and with the Eclipse IDE to create Java programs.

CS313D: ADVANCED PROGRAMMING LANGUAGE

Chapter 2: Using Data

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.

Data and Expressions. Outline. Data and Expressions 12/18/2010. Let's explore some other fundamental programming concepts. Chapter 2 focuses on:

Programming with Java

5/23/2015. Core Java Syllabus. VikRam ShaRma


Lesson 02 Data Types and Statements. MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL

Pace University. Fundamental Concepts of CS121 1

COP 3014: Fall Final Study Guide. December 5, You will have an opportunity to earn 15 extra credit points.

Core Java - SCJP. Q2Technologies, Rajajinagar. Course content

Primitive Data Types: Intro

Lecture 6. Assignments. Summary - Variables. Summary Program Parts 1/29/18. Reading: 3.1, 3.2, 3.3, 3.4

CONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17

Course Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++

CS111: PROGRAMMING LANGUAGE II

Lesson 02 Data Types and Statements. MIT 12043, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8

Data Conversion & Scanner Class

Review Chapters 1 to 4. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013

WA1278 Introduction to Java Using Eclipse

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02

HUDSONVILLE HIGH SCHOOL COURSE FRAMEWORK

CSC Java Programming, Fall Java Data Types and Control Constructs

Index COPYRIGHTED MATERIAL

KOMAR UNIVERSITY OF SCIENCE AND TECHNOLOGY (KUST)


A variable is a name for a location in memory A variable must be declared

Java How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.

College Board. AP CS A Labs Magpie, Elevens, and Picture Lab. New York: College Entrance Examination Board, 2013.

Lecture 6. Assignments. Java Scanner. User Input 1/29/18. Reading: 2.12, 2.13, 3.1, 3.2, 3.3, 3.4

Java Fall 2018 Margaret Reid-Miller

C-LANGUAGE CURRICULAM

COURSE OF STUDY UNIT PLANNING GUIDE COMPUTER SCIENCE 1 FOR: 5 CREDITS GRADE LEVEL: 9-12 FULL-YEAR COURSE PREPARED BY: SUSIE EISEN

Tentative Teaching Plan Department of Software Engineering Name of Teacher Dr. Naeem Ahmed Mahoto Course Name Computer Programming

CompuScholar, Inc. 9th - 12th grades

Java Foundations: Introduction to Program Design & Data Structures, 4e John Lewis, Peter DePasquale, Joseph Chase Test Bank: Chapter 2

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix

Computer Science (330)

Certification In Java Language Course Course Content

Peer Instruction 1. Elementary Programming

Language Reference Manual

CSI33 Data Structures

Lexical Considerations

What did we talk about last time? Examples switch statements

SSEA Computer Science: Track A. Dr. Cynthia Lee Lecturer in Computer Science Stanford

Java Programming Course Overview. Duration: 35 hours. Price: $900

Programming Language Basics

CS 302: Introduction to Programming

Lexical Considerations

1 Lexical Considerations

Department of Computer Science Purdue University, West Lafayette

Java Training JAVA. Introduction of Java

Course Outline. Introduction to java

AP Computer Science A

F1 A Java program. Ch 1 in PPIJ. Introduction to the course. The computer and its workings The algorithm concept

PRG PROGRAMMING ESSENTIALS. Lecture 2 Program flow, Conditionals, Loops

Hello World. n Variables store information. n You can think of them like boxes. n They hold values. n The value of a variable is its current contents

Chapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. A Guide to this Instructor s Manual:

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University

Getting started with Java

CISC-124. This week we continued to look at some aspects of Java and how they relate to building reliable software.

Lecture Set 2: Starting Java

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA

CO Java SE 8: Fundamentals

Practice exam for CMSC131-04, Fall 2017

TeenCoder : Java Programming (ISBN )

Using Java Classes Fall 2018 Margaret Reid-Miller

Lecture Set 2: Starting Java

JAVA REVIEW cs2420 Introduction to Algorithms and Data Structures Spring 2015

CS313D: ADVANCED PROGRAMMING LANGUAGE

H212 Introduction to Software Systems Honors

Midterm Review 01. SP17 ICS 111 Ed Meyer

COSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan

CMPT 125: Lecture 3 Data and Expressions

Chapter 2: Data and Expressions


Declaration and Memory

Review for Test 1 (Chapter 1-5)

Visual C# Instructor s Manual Table of Contents

The Sun s Java Certification and its Possible Role in the Joint Teaching Material

Language Features. 1. The primitive types int, double, and boolean are part of the AP

CSCI 131, Midterm Exam 1 Review Questions This sheet is intended to help you prepare for the first exam in this course. The following topics have

C++ (Non for C Programmer) (BT307) 40 Hours

Values and Variables 1 / 30

CS112 Lecture: Primitive Types, Operators, Strings

Chapter 2 Elementary Programming

SYLLABUS JAVA COURSE DETAILS. DURATION: 60 Hours. With Live Hands-on Sessions J P I N F O T E C H

Chief Reader Report on Student Responses:

Java Primer 1: Types, Classes and Operators

Transcription:

Exam 1 Prep Dr. Demetrios Glinos University of Central Florida COP3330 Object Oriented Programming

Progress Exam 1 is a Timed Webcourses Quiz You can find it from the "Assignments" link on Webcourses choose this D. Glinos COP3330 Object Oriented Programming 2

You may take the exam at any time during the day, but you must finish before midnight No class or office hours on exam days D. Glinos COP3330 Object Oriented Programming 3

D. Glinos COP3330 Object Oriented Programming 4

Exam Format 25 multiple choice questions 45 minutes to answer all of them average 1.8 minutes (108 seconds) per question approximately half will involve looking at code and answering questions about it output of snippet statement to complete remaining questions will ask questions about concepts choose correct Java statement D. Glinos COP3330 Object Oriented Programming 5

Topic Coverage Java application programming Java as an interpreted programming language compiling and running from the command line using command line arguments Object-oriented programming concepts classes and objects basic features of encapsulation, inheritance, and polymorphism D. Glinos COP3330 Object Oriented Programming 6

Topic Coverage (2) Data types and variables primitive and reference data types Constants Declaring and Initializing variables Default Values Class and Instance Variables Converting Strings to Numeric Data Types Java operators arithmetic, relational, and logical operators, including the remainder operator operator precedence integer division casting and automatic conversions to String type D. Glinos COP3330 Object Oriented Programming 7

Topic Coverage (3) Classes and objects access control basics multi-file programs constructors, including default constructors class and instance variables and methods Control flow if, if-else, and switch statements while, do-while, and for statements break and continue enhanced for statement (in arrays lecture) D. Glinos COP3330 Object Oriented Programming 8

Topic Coverage (4) Characters using charat() to read characters from a String how characters are read in as ints when read from a text file casting an int to a char comparing chars using == using single quotes for literals using Character.equals() to compare Strings reference type using double quotes for literals using length(), charat(), and trim() instance methods using + to concatenate using StringBuilder() using equals() instance method to compare finding elements and substrings converting between numbers and strings D. Glinos COP3330 Object Oriented Programming 9

Topic Coverage (5) Basic I/O processing command line arguments using a Scanner, including nested scanners how we use nasnext(), next(), nextline(), nextint() and nextdouble() methods string output using print() and println() formatted output using printf() Random number generation using Random class object generating an integer within a range generating real numbers within a range D. Glinos COP3330 Object Oriented Programming 10

Topic Coverage (6) Arrays what an array is and its characteristics how we access its elements using an integer index how we declare, create, and initialize arrays using multi-dimensional arrays default values for array elements obtaining the length of an array using array initializers passing arrays to methods difference between iterating using for-loop and enhanced for-loop D. Glinos COP3330 Object Oriented Programming 11

Not on Exam Installing Java and Eclipse Using Eclipse testing and verifying programs from the command line command line navigation Java naming conventions big numbers short-circuit evaluation Math class methods NumberFormat class code points and code units regular expressions exception handling (e.g., when reading a file, or array index out of bounds) Arrays utility class methods D. Glinos COP3330 Object Oriented Programming 12

Pop Quiz (1) D. Glinos COP3330 Object Oriented Programming 13

Pop Quiz (1) D. Glinos COP3330 Object Oriented Programming 14

Pop Quiz (2) D. Glinos COP3330 Object Oriented Programming 15

Pop Quiz (2) A 2-D array in Java is just a 1-D array where each element is itself a 1-D array The length of a 2-D array is just the length of its first dimension D. Glinos COP3330 Object Oriented Programming 16

Integer Arithmetic Basic rule: Arithmetic operations on integer variables produce integer results, even if we assign those results to double or float variables Example: int a = 5; int b = 2; int c = a / b; ß the value of c is 2, not 2.5 double d = a / b; ß the value of d is 2.0, not 2.5 To get a double result, we must use a double in the computation part of the expression. We can do this by casting one of the values, but we must be careful: double e = (double) ( a / b ); ß the value of e is still 2.0 double f = ( (double) a ) / b; ß the value of f is 2.5 (finally!) D. Glinos COP3330 Object Oriented Programming 17

Default Values Default values depend on the data type numeric data types: 0 boolean: false char: \u0000 all reference types: null When do variables get their default values? class and instance variables: when created arrays: when created, even if local local variables (other than arrays): must be explicitly initialized Output: Note: c[0] is null because the second dimension was never allocated D. Glinos COP3330 Object Oriented Programming 18

De Morgan s Laws De Morgan's Laws may be helpful when evaluating logical expressions:! ( a && b ) is equivalent to! a! b! ( a b ) is equivalent to! a &&! b For more info, see the Wikipedia page D. Glinos COP3330 Object Oriented Programming 19

Evaluating Logical Expressions Suppose we are given: boolean a = true; boolean b = false; boolean c = true; Q1: What is the value of! ( b && a )? Q2: What is the value of! ( b c )? Q3: What is the value of! ( b (! c ) )? D. Glinos COP3330 Object Oriented Programming 20

Evaluating Logical Expressions Suppose we are given: boolean a = true; boolean b = false; boolean c = true; Q1: What is the value of! ( b && a )? Answer: true, since b && a is false Q2: What is the value of! ( b c )? Q3: What is the value of! ( b (! c ) )? D. Glinos COP3330 Object Oriented Programming 21

Evaluating Logical Expressions Suppose we are given: boolean a = true; boolean b = false; boolean c = true; Q1: What is the value of! ( b && a )? Answer: true, since b && a is false Q2: What is the value of! ( b c )? Answer: false, since b c is true Q3: What is the value of! ( b (! c ) )? D. Glinos COP3330 Object Oriented Programming 22

Evaluating Logical Expressions Suppose we are given: boolean a = true; boolean b = false; boolean c = true; Q1: What is the value of! ( b && a )? Answer: true, since b && a is false Q2: What is the value of! ( b c )? Answer: false, since b c is true Q3: What is the value of! ( b (! c ) )? Answer: true, since!c is false, which makes b (!c) also false D. Glinos COP3330 Object Oriented Programming 23

Sample Code Output Question (1) Question: What is the output of the following program? D. Glinos COP3330 Object Oriented Programming 24

Sample Code Output Question (1) Question: What is the output of the following program? Answer: p = 102 D. Glinos COP3330 Object Oriented Programming 25

Sample Code Output Question (2) Question: What does the following method do? D. Glinos COP3330 Object Oriented Programming 26

Sample Code Output Question (2) Question: What does the following method do? Answer: It computes the average value of an array of doubles D. Glinos COP3330 Object Oriented Programming 27