Final Exam Review CSE113.

Slides:



Advertisements
Similar presentations
Java Control Statements
Advertisements

CIS101 Introduction to Computing Week 12. Agenda Your questions Solutions to practice text Final HTML/JavaScript Project Copy and paste assignment JavaScript:
© red ©
True or false A variable of type char can hold the value 301. ( F )
I.1 ii.2 iii.3 iv.4 1+1=. i.1 ii.2 iii.3 iv.4 1+1=
1 September 6, 2005CS150 Introduction to Computer Science I What Actions Do We Have Part 1 CS150 Introduction to Computer Science I.
COMP 14 Introduction to Programming Miguel A. Otaduy May 20, 2004.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 4 - Program Control Outline 4.1Introduction 4.2The Essentials of Repetition 4.3Counter-Controlled.
I.1 ii.2 iii.3 iv.4 1+1=. i.1 ii.2 iii.3 iv.4 1+1=
COMP 110 Switch Statements and Loops Tabitha Peck M.S. February 6, 2008 MWF 3-3:50 pm Philips
CIS3931 – Intro to JAVA Lecture Note Set 3 19-May-05.
Presented by Joaquin Vila Prepared by Sally Scott ACS 168 Problem Solving Using the Computer Week 12 Boolean Expressions, Switches, For-Loops Chapter 7.
CP104 Introduction to Programming Selection Structures_3 Lecture 11 __ 1 The Switch Statement The switch statement provides another means to select one.
More While Loop Examples CS303E: Elements of Computers and Programming.
Mathematics Arithmetic Sequences Science and Mathematics Education Research Group Supported by UBC Teaching and Learning Enhancement Fund Department.
Previously Repetition Structures While, Do-While, For.
Control Structures RepetitionorIterationorLooping Part I.
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
In the last lesson we discussed about: Casting Precedence The “=“ used as an assignment operator Made a calculate average program.
Modular Programming – User Defined Functions. CSCE 1062 Outline  Modular programming – user defined functions  Value returning functions  return statement.
1 CS 177 Week 6 Recitation Slides Review for Midterm Exam.
Session 2 Operators, Decisions and Loops. Objectives Operators Casting data Decision marking structures Loops break, continue, return.
CS Class 04 Topics  Selection statement – IF  Expressions  More practice writing simple C++ programs Announcements  Read pages for next.
C syntax (simplified) BNF. Program ::= [ ] Directives ::= [ ] ::= | |… ::=#include > ::=#define.
L131 Assignment Operators Topics Increment and Decrement Operators Assignment Operators Debugging Tips rand( ) math library functions Reading Sections.
 Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do.
UCT Department of Computer Science Computer Science 1015F Iteration
PHP Condtions and Loops Prepared by Dr. Maher Abuhamdeh.
DEVRY CIS 115 Final Exam 1 Check this A+ tutorial guideline at For more classes visit
Some Assignments  Write a program which prints the following information about at least 5 persons: NAME MAIL-ID EMPLOYEE-CODE PHONE Eg. Umesh
UMBC CMSC 104 – Section 01, Fall 2016
What Actions Do We Have Part 1
Controlling execution - iteration
Chapter 4 - Program Control
CIS 115 Lessons in Excellence-- cis115.com. CIS 115 All Exercises Devry University (Devry) For more course tutorials visit CIS 115 All.
CIS 115 Education for Service-- cis115.com. CIS 115 All Exercises Devry University (Devry) For more course tutorials visit CIS 115 All.
2.0 FUNDAMENTALS OF JAVA PROGRAMMING LANGUAGE
11/10/2018.
Logical Operators and While Loops
Looping.
Chapter 4 LOOPS © Bobby Hoggard, Department of Computer Science, East Carolina University / These slides may not be used or duplicated without permission.
CS149D Elements of Computer Science
Decision Making.
Introduction to Programming
3-3 Side Effects A side effect is an action that results from the evaluation of an expression. For example, in an assignment, C first evaluates the expression.
Structured Program Development in C
Chapter 4 - Program Control
The switch statement: an alternative to writing a lot of conditionals
LOOPS BY: LAUREN & ROMEO.
Arrays, Part 1 of 2 Topics Definition of a Data Structure
Level 0.
Assignment Operators Topics Increment and Decrement Operators
Assignment Operators Topics Increment and Decrement Operators
Arrays, Part 1 of 2 Topics Definition of a Data Structure
CS150 Introduction to Computer Science 1
CS150 Introduction to Computer Science 1
Review for Final Exam.
Conditional statement & LOOPS
What Color is it?.
Fundamental Programming
CS 101 First Exam Review.
CSC1401 Manipulating Pictures 2
Lec 6 Loop Statements Introduction to Computer Programming
Types of loops definite loop: A loop that executes a known number of times. Examples: Repeat these statements 10 times. Repeat these statements k times.
Arrays, Part 1 of 2 Topics Definition of a Data Structure
The Python interpreter
Assignment Operators Topics Increment and Decrement Operators
Programming Fundamental
Final Exam Review CSE113 B.Ramamurthy 10/13/2019 B.Ramamurthy.
Presentation transcript:

Final Exam Review CSE113

Arithmetic Expression Assume A = 2, B =4, C =10, D=5, evaluate the following expressions. Ans1 = A + B - C + D Ans2 = B * C / A Ans3 = C + B – D/A Ans4 = B * (C/A) Ans5 = C % B * D Ans6 = (C+B – D)/A

While loop What is the output when the “while” loop given below is executed? Assume number generated are : 0, 4, 3, 2 ,5, 3, 5, 3, 4, 2,…. int ans = 0; int count = 1; int num; while (count < 5) { num = Greenfoot.getRandomNumber(6); if (num % 2 == 0) { ans = ans + num; } count = count + 1; }

While loop Write a while that adds 4 crabs in a vertical line to the world at locations {(10, 100), (20, 100), (30, 100) etc. } How will you modify this to add 10 crabs?

Array Definition You want to create a scenario with a (i) pink worm (pworm.jpg), (ii) blue worm (bworm.jpg), (iii) brown carb (bcrab.jpg), (iv) green crab (gcrab.jpg), (v) red lobster (rlob.jpg). Write an array definition for this and initialize it with the image files given above.

For statement Use a “for” statement to add the above objects to the world.

Evaluate the “for” statement What does the following “for” evaluate? int sumSq = 0; int sq; for (int i = 0; i < 4; i++) { sq = i* I; sumSq = sumSq + sq; }

Evaluate the Switch statement switch (color) { case ‘v’ : {bg.SetColor(Color.VIOLET); break;} case ‘i’ : {bg.SetColor(Color.INDIGO); break;} case ‘b’ : {bg.SetColor(Color.BLUE); break;} case ‘g’ : {bg.SetColor(Color.GREEN); break;} case ‘y’ : {bg.SetColor(Color.YELLOW); break;} case ‘o’ : {bg.SetColor(Color.ORANGE); break;} case ‘r’ : {bg.SetColor(Color.RED); break;} default: { bg.setColor(Color.BLACK);} } If color is assigned ‘i’ what is the color for writing?

Write a switch statement Write a switch statement that converts a number representing day of the week into a word for the day.

Evaluate the method calls Using the calculator class and its methods write a set of call that will evaluate: 5 + 6* 14 -16/3

Write a method Write a method that computes the distance between two location and outputs the distance on the screen.