Page 1 Quiz by Joseph Lindo. Page 2 Program Analysis by providing the output of a program snippet Some are true or false Some have choices.

Slides:



Advertisements
Similar presentations
Introduction to arrays
Advertisements

CSCI 160 Midterm Review Rasanjalee DM.
Jeopardy Multiple Choice Fill in the Blank Modified T/F Vocabulary Positioning of data Q $100 Q $200 Q $300 Q $400 Q $500 Q $100 Q $200 Q $300 Q $400.
Arrays, A1 COMP 401, Fall 2014 Lecture 4 8/28/2014.
Grouping objects Arrays and for loops. Fixed-size collections Sometimes the maximum collection size can be pre-determined. Programming languages usually.
Rational Inequalities Page 5 #2: Steps: 1.Get 0 on one side of inequality. 2.Get a common denominator and combine terms 3.Find Critical Values for numerator.
Arrays An array is a collection of variables, all of the same type. An array is created with the new operator. The size of an array must be specified at.
Operating Systems Review. Questions What are two functions of an OS? What “layer” is above the OS? What “layer” is below the OS?
Fixing Broken Programs. How do you figure out what’s wrong? Look carefully at the error message. Locate the error – Most messages have line numbers –
Software Testing and Quality Assurance
Operating Systems Review. Questions What are two functions of an OS? What “layer” is above the OS? What “layer” is below the OS?
Operating Systems Review. Outline Intro –What is an OS, OS History Operating System Concepts –Processes, Files, System Calls, Shells Operating System.
Copyright 2008 by Pearson Education 1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
Operating Systems Review. Questions What are two functions of an OS? What “layer” is above the OS? What “layer” is below the OS?
03/16/ What is an Array?... An array is an object that stores list of items. Each slot of an array holds an individual element. Characteristics.
Iteration and Simple Menus Deterministic / Non-deterministic loops and simple menus.
The University of Texas – Pan American
Arrays (Part 1) Computer Science Erwin High School Fall 2014.
PreAP Computer Science Quiz
Java Quiz Bowl A fun review of the Java you should know from CMPT 201 If you don’t know the answers - this week is for you to study up!
Arrays and ArrayLists in Java L. Kedigh. Array Characteristics List of values. A list of values where every member is of the same type. Each member in.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Chapter 8: Collections: Arrays. 2 Objectives One-Dimensional Arrays Array Initialization The Arrays Class: Searching and Sorting Arrays as Arguments The.
Lecture 5: Arrays A way to organize data MIT AITI April 9th, 2005.
CHAPTER: 12. Array is a collection of variables of the same data type that are referenced by a common name. An Array of 10 Elements of type double.
Collections. The Plan ● Why use collections? ● What collections are available? ● How are the collections different? ● Examples ● Practice.
Computer Programming 12 Mr. Jean April 24, The plan: Video clip of the day Upcoming Quiz Sample arrays Using arrays More about arrays.
CSc2310 tutoring session, week 8 Fall, 2012 Haidong Xue 5:30pm—8:30pm 11/06/2012 and 11/07/2012 -Test 3 Study Guide.
Lec 20 More Arrays--Algorithms. Agenda Array algorithms (section 7.5 in the book) – An algorithm is a well-defined specification for solving a problem.
Arrays  Array is a collection of same type elements under the same variable identifier referenced by index number.  Arrays are widely used within programming.
CHAPTER 7 arrays I NTRODUCTION T O C OMPUTER P ROGRAMMING (CSC425)
Copyright 2008 by Pearson Education 1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
ArrayList Class An ArrayList is an object that contains a sequence of elements that are ordered by position. An ArrayList is an object that contains a.
Two-Dimensional Arrays That’s 2-D Arrays Girls & Boys! One-Dimensional Arrays on Steroids!
18-1 Queues Data Structures and Design with Java and JUnit © Rick Mercer.
ITI 1120 Lab #5 Contributors: S. Boyd, R. Plesa, A. Felty, D. Inkpen, A. Williams, D. Amyot.
CS 139-Programming Fundamentals Lecture 11B - Arrays Adapted from a presentation by Dr. Rahman Fall 2014.
Introduction to Computing Concepts Note Set 15. JOptionPane.showMessageDialog Message Dialog Allows you to give a brief message to the user Can be used.
CHAPTER 10 ARRAYS AND FUNCTIONS Prepared by: Lec. Ghader Kurdi.
Copyright 2010 by Pearson Education 1 Building Java Programs Chapter 2 Lecture 2-1: Expressions and Variables reading:
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
CSE 201 – Elementary Computer Programming 1 Extra Exercises Sourceshttp://
Agenda Perform Quiz #1 (20 minutes) Loops –Introduction / Purpose –while loops Structure / Examples involving a while loop –do/while loops Structure /
Arrays. Collections We would like to be able to keep lots of information at once Example: Keep all the students in the class Grade each one without writing.
 MergeSort is a sorting algorithm which is more on the advanced end.  It is very fast, but unfortunately uses up a lot of memory due to the recursions.
int num = 22; if (num > 0) if (num % 5 == 0) System.out.println(num); else System.out.println(num + “ is negative”);
Fundamental Programming Fundamental Programming More Expressions and Data Types.
11 PART 2 ARRAYS. 22 PROCESSING ARRAY ELEMENTS Reassigning Array Reference Variables The third statement in the segment below copies the address stored.
Arrays Chapter 12. Overview Arrays and their properties Creating arrays Accessing array elements Modifying array elements Loops and arrays.
COMP More About Arrays Yi Hong June 05, 2015.
Multidimensional Arrays tMyn1 Multidimensional Arrays It is possible to declare arrays that require two or more separate index values to access an element.
Multi-dimensional Array 1 Multi-dimensional array refers to an array with more than one index. It is a logical representation. On physical storage, the.
The ArrayList Data Structure The Most Important Things to Review.
COMP 110: Spring Announcements Lab 7 was due today Binary Expression Assignment due Friday.
1 CSC103: Introduction to Computer and Programming Lecture No 17.
 Array ◦ Single & Multi-dimensional  Java Operators ◦ Assignment ◦ Arithmetic ◦ Relational ◦ Logical ◦ Bitwise & other.
For Friday Read No quiz Program 6 due. Program 6 Any questions?
ARRAY AND LOOPS REVIEW Mr. Crone. What will the code below print? int[] arry = {2, 5, 2, 1, 3}; for(int i = 0; i < 5; i ++) System.out.print(arry[i]);
Arrays. What is an array? An array is a collection of data types. For example, what if I wanted to 10 different integers? int num1; int num2; int num3;
 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.
CIS3931 – Intro to JAVA Lecture Note Set 2 17-May-05.
Number and patterns quiz
Building Java Programs Chapter 2
What output is produced by the following fragment?
Arrays.
Arrays ICS2O.
Multidimensional Arrays
Building Java Programs
QUIZ 5 – RESULT.
Building Java Programs
Presentation transcript:

Page 1 Quiz by Joseph Lindo

Page 2 Program Analysis by providing the output of a program snippet Some are true or false Some have choices

Page 3 Question 1. What is the output of the program below? int[] num = new int [5]; System.out.println(num.length);

Page 4 Question 2. What is the output of the program below? int[] num = {3,4,2,7,8,10,30}; System.out.println(num.length);

Page 5 Question 3. What is the output of the program below? int[][] num = new int [5][3]; System.out.println(num.length); a) 3 b) 5 c) 15 d) 0 e) null

Page 6 Question 4. What is the output of the program below? int[] num = {3,4,2,7,8,10,30}; System.out.println(num[5]);

Page 7 Question 5. What is the output of the program below? int[] num = {3,4,2,7,8,10,30}; System.out.println(num[7]); a) 30 b) 10 c) Error message d) 0 e) null

Page 8 Question 6. Single Dimension : List Three Dimension : ___________

Page 9 Question 7. True or false Once the size of an array has been specified, it is still can be resize on the later part of the program.

Page 10 Question 8. What is the output of the program below? int[] num = {3,4,2,7,8,10,30}; System.out.println(‘‘num.length’’);

Page 11 Question 9. What is the output of the program below? int[][] num = new int[5][6]; int x = num.length; System.out.println(x);

Page 12 Question 10. What is the output of the program below? int[][] num = new int[5][6]; int x = num[5].length; System.out.println(x); a.6 b.5 c.0 d.Error message

Page 13 Question 11 – 15. What is the output of the program below? int[] num = {3,4,2,7,8,10,30}; for(int i=num.length-1; i>1;i--){ System.out.println(num[i]); }

Page 14 Question 16. What is the index combination of the colored cell? a) arr[3][4] b) arr[arr.length-1][2] c) arr[4][2] d) arr[4][3]

Page 15 Question 17. Single Dimension : List Two Dimension : ___________

Page 16 Question 18. True or false Array stores multiple data types.

Page 17 Question 19. True or false Index of an array always start from 0 up to array.length.

Page 18 Question 20. What is the equation to be used to display the full size of the array? int[][] num = new int[5][6]; int x = ?? System.out.println(x); a.num.length*num[0].length b.num.length*num[4].length c.num.length*num[5].length d.All of the above e.None of the above f. A and B only g. A and C only

Page 19 Question What is the output of the program below? int[] num = {3,4,2,7,8,10,30}; for(int i=num.length-3; i>=1;i--){ System.out.println(num[i-1]); }