Exam 2. CSC 121 TTH Class. Lecturer: Howard Rosenthal. April 26, 2016
|
|
- Justin Hall
- 5 years ago
- Views:
Transcription
1 Your Name: Exam 2. CSC 121 TTH Class Lecturer: Howard Rosenthal April 26, 2016 The following questions (or parts of questions) in numbers 1-7 are all worth 3 points each. 1. Answer the following as true or false. a. Every for loop must be executed at least once. b. Every row of a two-dimensional array has its own length. c. An array reference variable of type long can refer to an array of the same number of dimensions of type int. d. The parameters in the header of a method are called actual parameters. e. Different rows in a two-dimensional array can hold different types of data. f. When a boolean array is created all the cells are initialized to the value false. g. Any iteration that you can perform with a while statement can also be performed with a do-while statement. h. Every method must return a value. i. Binary searches require that the list first be sorted. j. The length of a one-dimensional array is one greater than the number of cells of the array. k. Input to the JVM is in Unicode format. 2. Given the following initialization int [][] array1 = new int [7][4]; The value array1.length =. 3. The number of bytes reserved for the array double [][] darray = new double [3][4] is 4. Write a statement that declares and instantiates a float array called floatarray of length 12. 1
2 5. Give two different examples of method overloading that display two different ways that methods can be overloaded. (Each example requires two methods with the same name) a. b. 6. Write a single statement the declares, instantiates and initializes an array of type short called shortarray equivalent to the following table:
3 7. What is the printout from the code segment below: int [] ref1 = new int [3]; int [] ref2; for (int i=0; i<3; i++) ref1[i] =2*i; ref2 =ref1; for (int i=0; i<3; i++) (ref2[i] = ref2[i] -1); for (int i=0; i<3; i++) System.out.println(ref1[i]); 8. What are the values stored in the array a after the following code executes: int [] a = new int [8]; sum =0; for (int i = 1; i < a.length; i++) { a[i] = (i%3) +sum; sum = a[i]; } 3
4 Programs: It is important to follow the instructions in each problem. Note: The second problem is on page 5. two.java files to Do not mail these files until you are done with the entire exam. No second mailing will be allowed 1. CalculateHypotenuse (16 points) Write a class called CalculateHypotenuse with the main method and hypocalc method as described below. Write a main method that performs the following 5 times: a. Reads in a pair of numbers of type double representing the two legs of a right triangle b. Calls hypocalc c. Prints out the hypotenuse as follows: The hypotenuse of a right triangle with side one length side1 and side two length side2 is hypotenuse. hypocalc is defined as below: a. Has two type double variables as formal parameters b. Returns the hypotenuse as a type double. You can use Math.pow to calculate the hypotenuse. Remember hypotenuse = (leg1 2 +leg2 2 ) 1/2 4
5 2. FindProducts (32) Write a class FindProducts that does the following: a. The main method does the following: 1. Requests from the user the number of rows for a two-dimensional array. 2. Calls the method createarray to create a two-dimensional int array 3. Calls a method arrayfull with a reference to the array created by createarray 4. Calls a method called getproducts with a reference to the array created by createarray, and accepts a reference to a one-dimensional array as a return value. 5. Prints out the elements of the two-dimensional array row by row. 6. Prints out a sentence for each row that looks like this: The product of row x is product. (Note: x and product are actual numbers). b. createarray 1. Accepts the rows of a two-dimensional int array as parameters 2. Creates a two-dimensional int array with 4 columns for each row. 3. Returns a reference to the array that was created c. arrayfull 1. Has a two-dimensional int array as its formal parameter 2. Fills a two dimensional int array with random integers from 1 to 10 d. getproducts 1. Has a two-dimensional int array as its formal input parameter 2. Finds the product for each row 3. Returns the product of each row in a one-dimensional array with the product for each row in a corresponding cell. 5
6 6
7 7
Exam 2. CSC 121 MW Class. Lecturer: Howard Rosenthal. April 25, 2016
Your Name: Exam 2. CSC 121 MW Class Lecturer: Howard Rosenthal April 25, 2016 The following questions (or parts of questions) in numbers 1-7 are all worth 3 points each. 1. Answer the following as true
More informationExam 2. CSC 121 MW Class. Lecturer: Howard Rosenthal. April 26, 2017
Your Name: Exam 2. CSC 121 MW Class Lecturer: Howard Rosenthal April 26, 2017 The following questions (or parts of questions) in numbers 1-7 are all worth 3 points each. 1. Answer the following as true
More informationFinal Exam. CSC 121 Spring 2016 TTH. Lecturer: Howard Rosenthal. May 17, 2016
Your Name: Final Exam. CSC 121 Spring 2016 TTH Lecturer: Howard Rosenthal May 17, 2016 The following questions (or parts of questions) in numbers 1-17 are all worth 2 points each. The programs have indicated
More informationFinal Exam. CSC 121 Spring Lecturer: Howard Rosenthal. May 17, 2017
Final Exam. CSC 121 Spring 2017 Lecturer: Howard Rosenthal May 17, 2017 Your Name: Answer Key The following questions (or parts of questions) in numbers 1-17 are all worth 2 points each. The programs have
More information2. Each element of an array is accessed by a number known as a(n) a. a. subscript b. size declarator c. address d. specifier
Lesson 4 Arrays and Lists Review CSC 123 Fall 2018 Answer Sheet Short Answers 1. In an array declaration, this indicates the number of elements that the array will have. b a. subscript b. size declarator
More informationFinal Exam. CSC 121 Fall 2015 TTH. Lecturer: Howard Rosenthal. Dec. 15, 2015
Final Exam. CSC 121 Fall 2015 TTH Lecturer: Howard Rosenthal Dec. 15, 2015 Your Name: Key The following questions (or parts of questions) in numbers 1-17 are all worth 2 points each. The programs have
More informationFinal Exam. CSC 121 Fall Lecturer: Howard Rosenthal. Dec. 13, 2017
Your Name: Final Exam. CSC 121 Fall 2017 Lecturer: Howard Rosenthal Dec. 13, 2017 The following questions (or parts of questions) in numbers 1-17 are all worth 2 points each. The programs have indicated
More informationExam 1 Answer Key CSC 123 Fall 2018 Lecturer: Howard Rosenthal Oct. 17, 2018
Your Name: Exam 1 Answer Key CSC 123 Fall 2018 Lecturer: Howard Rosenthal Oct. 17, 2018 The following questions in numbers 1-11 are all worth 3 points each (including each true and false). The programs
More informationAll answers will be posted on web site, and most will be reviewed in class.
Lesson 4 Arrays and Lists Review CSC 123 Fall 2018 Notes: All homework must be submitted via e-mail. All parts of assignment must be submitted in a single e-mail with multiple attachments when required.
More informationExam 1. CSC 121 Spring Lecturer: Howard Rosenthal. March 1, 2017
Exam 1. CSC 121 Spring 2017 Lecturer: Howard Rosenthal March 1, 2017 Your Name: Key 1. Fill in the following table for the 8 primitive data types. Spell the types exactly correctly. (16 points total) Data
More informationFinal Exam. CSC 121 Fall Lecturer: Howard Rosenthal. Dec. 13, 2017
Your Name: Final Exam. CSC 121 Fall 2017 Lecturer: Howard Rosenthal Dec. 13, 2017 The following questions (or parts of questions) in numbers 1-17 are all worth 2 points each. The programs have indicated
More informationFinal Exam. CSC 121 Fall 2015 MW. Lecturer: Howard Rosenthal. Dec. 16, 2015
Your Name: Final Exam. CSC 121 Fall 2015 MW Lecturer: Howard Rosenthal Dec. 16, 2015 The following questions (or parts of questions) in numbers 1-17 are all worth 2 points each. The programs have indicated
More informationTest 1. CSC 121 Lecture Lecturer: Howard Rosenthal. March 4, 2014
1 Test 1. CSC 121 Lecture 21199 Lecturer: Howard Rosenthal March 4, 2014 Your Name: KEY The following questions (or parts of questions) in numbers 1-16 are all worth 2 points each. 1. Fill in the following
More informationQ1 Q2 Q3 Q4 Q5 Total 1 * 7 1 * 5 20 * * Final marks Marks First Question
Page 1 of 6 Template no.: A Course Name: Computer Programming1 Course ID: Exam Duration: 2 Hours Exam Time: Exam Date: Final Exam 1'st Semester Student no. in the list: Exam pages: Student's Name: Student
More informationCSC Java Programming, Fall Java Data Types and Control Constructs
CSC 243 - Java Programming, Fall 2016 Java Data Types and Control Constructs Java Types In general, a type is collection of possible values Main categories of Java types: Primitive/built-in Object/Reference
More informationCS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University
9/5/6 CS Introduction to Computing II Wayne Snyder Department Boston University Today: Arrays (D and D) Methods Program structure Fields vs local variables Next time: Program structure continued: Classes
More informationArrays and Lists CSC 121 Fall 2014 Howard Rosenthal
Arrays and Lists CSC 121 Fall 2014 Howard Rosenthal Lesson Goals Understand what an array is Understand how to declare arrays Understand what reference variables are Understand how to pass arrays to methods
More informationArrays and Lists CSC 121 Fall 2015 Howard Rosenthal
Arrays and Lists CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Understand what an array is Understand how to declare arrays Understand what reference variables are Understand how to pass arrays to methods
More informationReview Chapter 6 in Bravaco. Short Answers 1. This type of method does not return a value. a. null b. void c. empty d. anonymous
Assignment 3 Methods Review CSC 123 Fall 2018 Notes: All homework must be submitted via e-mail. All parts of assignment must be submitted in a single e-mail with multiple attachments when required. Notes:
More informationChapter 9 Introduction to Arrays. Fundamentals of Java
Chapter 9 Introduction to Arrays Objectives Write programs that handle collections of similar items. Declare array variables and instantiate array objects. Manipulate arrays with loops, including the enhanced
More informationCS313D: ADVANCED PROGRAMMING LANGUAGE
CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science Department Lecture 3: C# language basics Lecture Contents 2 C# basics Conditions Loops Methods Arrays Dr. Amal Khalifa, Spr 2015 3 Conditions and
More informationArrays and Lists CSC 121 Fall 2016 Howard Rosenthal
Arrays and Lists CSC 121 Fall 2016 Howard Rosenthal Lesson Goals Understand what an array is Understand how to declare arrays Understand what reference variables are Understand how to pass arrays to methods
More informationArrays and Lists Review CSC 123 Fall 2018 Howard Rosenthal
Arrays and Lists Review CSC 123 Fall 2018 Howard Rosenthal Lesson Goals Review what an array is Review how to declare arrays Review what reference variables are Review how to pass arrays to methods Review
More informationCS313D: ADVANCED PROGRAMMING LANGUAGE. Lecture 3: C# language basics II
CS313D: ADVANCED PROGRAMMING LANGUAGE Lecture 3: C# language basics II Lecture Contents 2 C# basics Methods Arrays Methods 3 A method: groups a sequence of statement takes input, performs actions, and
More informationLesson 06 Arrays. MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL
Lesson 06 Arrays MIT 11053, Fundamentals of Programming By: S. Sabraz Nawaz Senior Lecturer in MIT Department of MIT FMC, SEUSL Array An array is a group of variables (called elements or components) containing
More informationCS1004: Intro to CS in Java, Spring 2005
CS1004: Intro to CS in Java, Spring 2005 Lecture #16: Java conditionals/loops, cont d. Janak J Parekh janak@cs.columbia.edu Administrivia Midterms returned now Weird distribution Mean: 35.4 ± 8.4 What
More information2/3/2018 CS313D: ADVANCED PROGRAMMING LANGUAGE. Lecture 3: C# language basics II. Lecture Contents. C# basics. Methods Arrays. Dr. Amal Khalifa, Spr17
CS313D: ADVANCED PROGRAMMING LANGUAGE Lecture 3: C# language basics II Lecture Contents 2 C# basics Methods Arrays 1 Methods : Method Declaration: Header 3 A method declaration begins with a method header
More informationExpressions and Data Types CSC 121 Fall 2015 Howard Rosenthal
Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types and
More informationFinal Exam Review April 18, 2018
Engr 123 Name Final Exam Review April 18, 2018 Final Exam is Monday April 30, 2018 at 8:00am 1. If i, j, and k are all of type int and i = 0, j = 2, and k = -8, mark whether each of the following logical
More informationESC101 : Fundamental of Computing
ESC101 : Fundamental of Computing End Semester Exam 19 November 2008 Name : Roll No. : Section : Note : Read the instructions carefully 1. You will lose 3 marks if you forget to write your name, roll number,
More informationLesson 9: Introduction To Arrays (Updated for Java 1.5 Modifications by Mr. Dave Clausen)
Lesson 9: Introduction To Arrays (Updated for Java 1.5 Modifications by Mr. Dave Clausen) 1 Lesson 9: Introduction Objectives: To Arrays Write programs that handle collections of similar items. Declare
More information2-D Arrays. Of course, to set each grid location to 0, we have to use a loop structure as follows (assume i and j are already defined):
2-D Arrays We define 2-D arrays similar to 1-D arrays, except that we must specify the size of the second dimension. The following is how we can declare a 5x5 int array: int grid[5][5]; Essentially, this
More informationCS 12 Fall 2003 Solutions for mid-term exam #2
CS 12 Fall 2003 Solutions for mid-term exam #2 1. (10 points) Compilers and interpreters Provide short answers (a few sentences at most) to the following questions. (a) What is the difference between a
More informationCS111: PROGRAMMING LANGUAGE II
CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 1(c): Java Basics (II) Lecture Contents Java basics (part II) Conditions Loops Methods Conditions & Branching Conditional Statements A
More informationCOS 126 General Computer Science Spring Written Exam 2
COS 126 General Computer Science Spring 2011 Written Exam 2 This test has 10 questions worth a total of 50 points. You have 50 minutes. The exam is closed book, except that you are allowed to use a one
More informationObject Oriented Programming. Java-Lecture 6 - Arrays
Object Oriented Programming Java-Lecture 6 - Arrays Arrays Arrays are data structures consisting of related data items of the same type In Java arrays are objects -> they are considered reference types
More informationArrays. Lecture 11 CGS 3416 Fall October 26, 2015
Arrays Lecture 11 CGS 3416 Fall 2015 October 26, 2015 Arrays Definition: An array is an indexed collection of data elements of the same type. Indexed means that the array elements are numbered (starting
More informationIntroduction to Programming in C Department of Computer Science and Engineering. Lecture No. #16 Loops: Matrix Using Nested for Loop
Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #16 Loops: Matrix Using Nested for Loop In this section, we will use the, for loop to code of the matrix problem.
More informationCS 163 Practice Final Exam Winter 2012
CS 163 Practice Final Exam Winter 2012 The final exam is Saturday, 21 April. Any problem from either midterm or either practice midterm may (and often does) appear again on the final. In addition, make
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationMobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02
Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02 Hello, in this lecture we will learn about some fundamentals concepts of java.
More informationCSCE 206: Structured Programming in C++
CSCE 206: Structured Programming in C++ 2017 Spring Exam 3 Monday, April 17, 2017 Total - 100 Points B Instructions: Total of 11 pages, including this cover and the last page. Before starting the exam,
More informationCSCE 206: Structured Programming in C++
CSCE 206: Structured Programming in C++ 2017 Spring Exam 3 Monday, April 17, 2017 Total - 100 Points A Instructions: Total of 11 pages, including this cover and the last page. Before starting the exam,
More informationArrays. Lecture 11 CGS 3416 Spring March 6, Lecture 11CGS 3416 Spring 2017 Arrays March 6, / 19
Arrays Lecture 11 CGS 3416 Spring 2017 March 6, 2017 Lecture 11CGS 3416 Spring 2017 Arrays March 6, 2017 1 / 19 Arrays Definition: An array is an indexed collection of data elements of the same type. Indexed
More informationChapter 6 Single-Dimensional Arrays. Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved.
Chapter 6 Single-Dimensional Arrays rights reserved. 1 Opening Problem Read one hundred numbers, compute their average, and find out how many numbers are above the average. Solution AnalyzeNumbers rights
More informationIt is a constructor and is called using the new statement, for example, MyStuff m = new MyStuff();
COSC 117 Exam 3 Key Fall 2012 Part 1: Definitions & Short Answer (3 Points Each) 1. A method in a class that has no return type and the same name as the class is called what? How is this type of method
More informationBasics of Java: Expressions & Statements. Nathaniel Osgood CMPT 858 February 15, 2011
Basics of Java: Expressions & Statements Nathaniel Osgood CMPT 858 February 15, 2011 Java as a Formal Language Java supports many constructs that serve different functions Class & Interface declarations
More informationCS Programming I: Arrays
CS 200 - Programming I: Arrays Marc Renault Department of Computer Sciences University of Wisconsin Madison Fall 2017 TopHat Sec 3 (PM) Join Code: 719946 TopHat Sec 4 (AM) Join Code: 891624 Array Basics
More informationFirst Name: Last: ID# 1. Hexadecimal uses the symbols 1, 2, 3, 4, 5, 6, 7 8, 9, A, B, C, D, E, F,G.
IST 311 - Exam1 - Fall 2015 First Name: Last: ID# PART 1. Multiple-choice / True-False (30 poinst) 1. Hexadecimal uses the symbols 1, 2, 3, 4, 5, 6, 7 8, 9, A, B, C, D, E, F,G. 2. The accessibility modifier
More informationArray Basics: Outline. Creating and Accessing Arrays. Creating and Accessing Arrays. Arrays (Savitch, Chapter 7)
Array Basics: Outline Arrays (Savitch, Chapter 7) TOPICS Array Basics Arrays in Classes and Methods Programming with Arrays Searching and Sorting Arrays Multi-Dimensional Arrays Static Variables and Constants
More informationCOS 126 General Computer Science Spring Written Exam 1
COS 126 General Computer Science Spring 2017 Written Exam 1 This exam has 9 questions (including question 0) worth a total of 70 points. You have 50 minutes. Write all answers inside the designated spaces.
More informationUNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 10 INTRODUCTION TO ARRAYS
UNIT 3 ARRAYS, RECURSION, AND COMPLEXITY CHAPTER 10 INTRODUCTION TO ARRAYS EXERCISE 10.1 1. An array can contain many items and still be treated as one thing. Thus, instead of having many variables for
More informationCSE 20. Lecture 4: Number System and Boolean Function. CSE 20: Lecture2
CSE 20 Lecture 4: Number System and Boolean Function Next Weeks Next week we will do Unit:NT, Section 1. There will be an assignment set posted today. It is just for practice. Boolean Functions and Number
More informationECE 122. Engineering Problem Solving with Java
ECE 122 Engineering Problem Solving with Java Lecture 10 For Loops and Arrays Outline Problem: How can I perform the same operations a fixed number of times? Considering for loops Performs same operations
More informationData Types, Variables and Arrays. OOC 4 th Sem, B Div Prof. Mouna M. Naravani
Data Types, Variables and Arrays OOC 4 th Sem, B Div 2016-17 Prof. Mouna M. Naravani Identifiers in Java Identifiers are the names of variables, methods, classes, packages and interfaces. Identifiers must
More informationTwo Types of Types. Primitive Types in Java. Using Primitive Variables. Class #07: Java Primitives. Integer types.
Class #07: Java Primitives Software Design I (CS 120): M. Allen, 13 Sep. 2018 Two Types of Types So far, we have mainly been dealing with objects, like DrawingGizmo, Window, Triangle, that are: 1. Specified
More informationLoops! Loops! Loops! Lecture 5 COP 3014 Fall September 25, 2017
Loops! Loops! Loops! Lecture 5 COP 3014 Fall 2017 September 25, 2017 Repetition Statements Repetition statements are called loops, and are used to repeat the same code mulitple times in succession. The
More informationHigh Institute of Computer Science & Information Technology Term : 1 st. El-Shorouk Academy Acad. Year : 2013 / Year : 2 nd
El-Shorouk Academy Acad. Year : 2013 / 2014 High Institute of Computer Science & Information Technology Term : 1 st Year : 2 nd Computer Science Department Object Oriented Programming Section (1) Arrays
More informationExam 3 Chapters 7 & 9
Exam 3 Chapters 7 & 9 CSC 2100-002/003 29 Mar 2017 Read through the entire test first BEFORE starting Put your name at the TOP of every page The test has 4 sections worth a total of 100 points o True/False
More informationLECTURE 5 Control Structures Part 2
LECTURE 5 Control Structures Part 2 REPETITION STATEMENTS Repetition statements are called loops, and are used to repeat the same code multiple times in succession. The number of repetitions is based on
More informationFORM 2 (Please put your name and form # on the scantron!!!!)
CS 161 Exam 2: FORM 2 (Please put your name and form # on the scantron!!!!) True (A)/False(B) (2 pts each): 1. Recursive algorithms tend to be less efficient than iterative algorithms. 2. A recursive function
More informationExpressions and Data Types CSC 121 Spring 2015 Howard Rosenthal
Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types
More information1 Short Answer (15 Points Each)
Name: Write all of your responses on these exam pages. If you need extra space please use the backs of the pages. 1 Short Answer (15 Points Each) 1. Write the following Java declarations, (a) A double
More informationEngr 123 April 25, 2018 Final Exam Review. 3. Write a method which will accept a string and return the number of three-letter words in the string.
Engr 123 April 25, 2018 Final Exam Review Final Exam is Monday April 30, 2018 at 8:00am 1. Write a method named EvenOdd which will accept a string and a bool as arguments. If the bool is true the method
More informationFinal Exam. COMP Summer I June 26, points
Final Exam COMP 14-090 Summer I 2000 June 26, 2000 200 points 1. Closed book and closed notes. No outside material allowed. 2. Write all answers on the test itself. Do not write any answers in a blue book
More information3. Convert 2E from hexadecimal to decimal. 4. Convert from binary to hexadecimal
APCS A Midterm Review You will have a copy of the one page Java Quick Reference sheet. This is the same reference that will be available to you when you take the AP Computer Science exam. 1. n bits can
More informationTrace call recsum(x, 3)
12. Section 8 Exercises Program Memory Exercise 8-1 Trace for this value of X Working memory Global Memory Trace call recsum(x, 3) GIVENS: x (an array of integers) n (number of elements to sum in x) RESULT:
More informationAPCS Semester #1 Final Exam Practice Problems
Name: Date: Per: AP Computer Science, Mr. Ferraro APCS Semester #1 Final Exam Practice Problems The problems here are to get you thinking about topics we ve visited thus far in preparation for the semester
More informationCS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims. Lecture 10: Asymptotic Complexity and
CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims Lecture 10: Asymptotic Complexity and What Makes a Good Algorithm? Suppose you have two possible algorithms or
More informationReviewing all Topics this term
Today in CS161 Prepare for the Final Reviewing all Topics this term Variables If Statements Loops (do while, while, for) Functions (pass by value, pass by reference) Arrays (specifically arrays of characters)
More informationa) Answer all questions. b) Write your answers in the space provided. c) Show all calculations where applicable.
Name: Please fill in your Student Number and Name. Student Number : Student Number: University of Cape Town ~ Department of Computer Science Computer Science 1015F ~ 2008 January Exam Question Max Internal
More informationAn array is a collection of data that holds fixed number of values of same type. It is also known as a set. An array is a data type.
Data Structures Introduction An array is a collection of data that holds fixed number of values of same type. It is also known as a set. An array is a data type. Representation of a large number of homogeneous
More informationLecture 2 Arrays, Searching and Sorting (Arrays, multi-dimensional Arrays)
Lecture 2 Arrays, Searching and Sorting (Arrays, multi-dimensional Arrays) In this lecture, you will: Learn about arrays Explore how to declare and manipulate data into arrays Understand the meaning of
More informationComputer Science 1 Ah
UNIVERSITY OF EDINBURGH course CS0077 COLLEGE OF SCIENCE AND ENGINEERING SCHOOL OF INFORMATICS Computer Science 1 Ah Resit Examination Specimen Solutions Date: Monday 1st September 2003 Time: 09:30 11:00
More informationSample Examination. Family Name:... Other Names:... Signature:... Student Number:...
Family Name:... Other Names:... Signature:... Student Number:... THE UNIVERSITY OF NEW SOUTH WALES SCHOOL OF COMPUTER SCIENCE AND ENGINEERING Sample Examination COMP1917 Computing 1 EXAM DURATION: 2 HOURS
More informationIntroductory Programming Arrays, sections
Introductory Programming Arrays, sections 7.1-7.4 + 7.6-7.7 Anne Haxthausen a, IMM, DTU 1. What is an array? (section 7.1-2) 2. Array types. (section 7.1-2) 3. How to declare and create an array? (section
More informationAnnouncements. PS 4 is ready, due next Thursday, 9:00pm. Midterm Exam 1: 10/14 (Fri), 9:00am-10:53am
Announcements PS 4 is ready, due next Thursday, 9:00pm Midterm Exam 1: 10/14 (Fri), 9:00am-10:53am Room TBD Scope: Lecture 1 to Lecture 9 (Chapters 1 to 6 of text) You may bring a sheet of paper (A4, both
More informationCSE548, AMS542: Analysis of Algorithms, Fall 2012 Date: October 16. In-Class Midterm. ( 11:35 AM 12:50 PM : 75 Minutes )
CSE548, AMS542: Analysis of Algorithms, Fall 2012 Date: October 16 In-Class Midterm ( 11:35 AM 12:50 PM : 75 Minutes ) This exam will account for either 15% or 30% of your overall grade depending on your
More informationChapter 01 Arrays Prepared By: Dr. Murad Magableh 2013
Chapter 01 Arrays Prepared By: Dr. Murad Magableh 2013 One Dimensional Q1: Write a program that declares two arrays of integers and fills them from the user. Then exchanges their values and display the
More informationAt this time we have all the pieces necessary to allocate memory for an array dynamically. Following our example, we allocate N integers as follows:
Pointers and Arrays Part II We will continue with our discussion on the relationship between pointers and arrays, and in particular, discuss how arrays with dynamical length can be created at run-time
More informationCS141 Programming Assignment #5
CS141 Programming Assignment #5 Due Wednesday, Nov 16th. 1) Write a class that asks the user for the day number (0 to 6) and prints the day name (Saturday to Friday) using switch statement. Solution 1:
More informationCS 115 Exam 3, Spring 2010
Your name: Rules You must briefly explain your answers to receive partial credit. When a snippet of code is given to you, you can assume o that the code is enclosed within some function, even if no function
More informationProgramming in C++ PART 2
Lecture 07-2 Programming in C++ PART 2 By Assistant Professor Dr. Ali Kattan 1 The while Loop and do..while loop In the previous lecture we studied the for Loop in C++. In this lecture we will cover iteration
More informationIntroduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview
Introduction to Visual Basic and Visual C++ Introduction to Java Lesson 13 Overview I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Overview JDK Editions Before you can write and run the simple
More informationCSC-140 Assignment 5
CSC-140 Assignment 5 Please do not Google a solution to these problems, cause that won t teach you anything about programming - the only way to get good at it, and understand it, is to do it! 1 Introduction
More information1 Short Answer (10 Points Each)
1 Short Answer (10 Points Each) 1. For the following one-dimensional array, show the final array state after each pass of the three sorting algorithms. That is, after each iteration of the outside loop
More informationarray Indexed same type
ARRAYS Spring 2019 ARRAY BASICS An array is an indexed collection of data elements of the same type Indexed means that the elements are numbered (starting at 0) The restriction of the same type is important,
More informationECE 122. Engineering Problem Solving with Java
ECE 122 Engineering Problem Solving with Java Lecture 5 Anatomy of a Class Outline Problem: How do I build and use a class? Need to understand constructors A few more tools to add to our toolbox Formatting
More informationUse the Scantron sheets to write your answer. Make sure to write your Purdue ID (NOT Purdue Login ID) and your name on the Scantron answer sheet.
Department of Computer Science Purdue University, West Lafayette Fall 2011: CS 180 Problem Solving and OO Programming Final Examination: Part A. You may consult the textbook and your hand written notes.
More informationProgramming Language Concepts: Lecture 2
Programming Language Concepts: Lecture 2 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2011 PLC 2011, Lecture 2, 6 January 2011 Classes and
More information. p.1/23. Today. 1. Questions and discussion from lecture. 2. Type-checking Functions Arrays Records (maybe)
. p.1/23 Today 1. Questions and discussion from lecture. 2. Type-checking Functions Arrays Records (maybe) . p.2/23 Type-checking functions Aspects: Overview of checks 6, 7 Declaration header Declaration
More informationYou should know the first sum above. The rest will be given if you ever need them. However, you should remember that,, and.
Big-Oh Notation Formal Definitions A function is in (upper bound) iff there exist positive constants k and n 0 such that for all. A function is in (lower bound) iff there exist positive constants k and
More informationSorting Algorithms part 1
Sorting Algorithms part 1 1. Bubble sort Description Bubble sort is a simple sorting algorithm. It works by repeatedly stepping through the array to be sorted, comparing two items at a time, swapping these
More informationNote: unless otherwise stated, the questions are with reference to the C Programming Language. You may use extra sheets if need be.
CS 156 : COMPUTER SYSTEM CONCEPTS TEST 1 (C PROGRAMMING PART) FEBRUARY 6, 2001 Student s Name: MAXIMUM MARK: 100 Time allowed: 45 minutes Note: unless otherwise stated, the questions are with reference
More informationGroups of two-state devices are used to represent data in a computer. In general, we say the states are either: high/low, on/off, 1/0,...
Chapter 9 Computer Arithmetic Reading: Section 9.1 on pp. 290-296 Computer Representation of Data Groups of two-state devices are used to represent data in a computer. In general, we say the states are
More informationAgenda CS121/IS223. Reminder. Object Declaration, Creation, Assignment. What is Going On? Variables in Java
CS121/IS223 Object Reference Variables Dr Olly Gotel ogotel@pace.edu http://csis.pace.edu/~ogotel Having problems? -- Come see me or call me in my office hours -- Use the CSIS programming tutors Agenda
More informationUNIVERSITY OF WINDSOR Winter 2007 QUIZ # 1 Solution. Examiner:Ritu Chaturvedi Dated : Feb 7 th, Student Name: Student Number:
UNIVERSITY OF WINDSOR 60-106-01 Winter 2007 QUIZ # 1 Solution Examiner:Ritu Chaturvedi Dated : Feb 7 th, 2007. Student Name: Student Number: INSTRUCTIONS (Please Read Carefully) No calculators allowed.
More informationChapter 6: Using Arrays
Chapter 6: Using Arrays Declaring an Array and Assigning Values to Array Array Elements A list of data items that all have the same data type and the same name Each item is distinguished from the others
More informationComputer Science is...
Computer Science is... Machine Learning Machine learning is the study of computer algorithms that improve automatically through experience. Example: develop adaptive strategies for the control of epileptic
More informationCSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2014
CSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2014 Name: This exam consists of 5 problems on the following 6 pages. You may use your double- sided hand- written 8 ½ x 11 note sheet
More information