CSE 131S Introduction to Computer Science Summer SON Exam I

Similar documents
CSE 131 Introduction to Computer Science Fall Exam I

CSE 131 Introduction to Computer Science Fall Exam I

CSE 131 Introduction to Computer Science Fall Exam I

CSE 131 Introduction to Computer Science Fall Exam II

CSE 247 Data Structures and Algorithms Fall Exam I

CSE 131 Introduction to Computer Science Fall Exam III

CSE 131 Introduction to Computer Science Fall 2016 Exam I. Print clearly the following information:

CSE 131 Introduction to Computer Science Fall Exam II

CSE 131S Introduction to Computer Science Summer SON Exam III

CSE 131 Introduction to Computer Science Fall Final Exam

CSE 131 Introduction to Computer Science Fall Exam II

Final Exam. COMP Summer I June 26, points

ENGR 100 Midterm (CSE Part) Winter 2014

CS 111X - Fall Test 1

CS 111X - Fall Test 1 - KEY KEY KEY KEY KEY KEY KEY

Solution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Spring Instructions:

Part 1 (80 points) Multiple Choice Questions (20 questions * 4 points per question = 80 points)

COMP 401 Midterm. Tuesday, Oct 18, pm-3:15pm. Instructions

Note that there are questions printed on both sides of each page!

Solution printed. Do not start the test until instructed to do so! CS 2604 Data Structures Midterm Summer I Instructions:

Fall 2002 Page 1 of 9 READ THIS NOW!

MCS-378 Intraterm Exam 1 Serial #:

CS 2505 Computer Organization I Test 1. Do not start the test until instructed to do so! printed

CS 1301 Exam 1 Fall 2010

CSE 160 Winter 2016: Final Exam

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible)

Do not start the test until instructed to do so!

CSE 160 Winter 2016: Final Exam

Do not start the test until instructed to do so!

CS 2505 Computer Organization I

CS 2505 Computer Organization I

CS 2505 Computer Organization I Test 1. Do not start the test until instructed to do so! printed

CS 2604 Minor Project 1 Summer 2000

COMP101: Final Review. With your boy(s), Mason and San

CS 110 Exam 2 Spring 2011

CS 2506 Computer Organization II Test 1. Do not start the test until instructed to do so! printed

Exam 1 Format, Concepts, What you should be able to do, and Sample Problems

Final Exam COMP Fall 2004 Dec 16, 2004

READ THIS NOW! Failure to read and follow the instructions below may result in severe penalties. Do not start the test until instructed to do so!

COMP 524 Spring 2018 Midterm Thursday, March 1

Decision Logic: if, if else, switch, Boolean conditions and variables

ECE 2035 A Programming HW/SW Systems Spring problems, 5 pages Exam Three 13 April Your Name (please print clearly)

Read this before starting!

CS 1301 Exam 1 Fall 2010

gcc o driver std=c99 -Wall driver.c bigmesa.c

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible)

Definition: A data structure is a way of organizing data in a computer so that it can be used efficiently.

COS 126 General Computer Science Spring Written Exam 1

The Irving K. Barber School of Arts and Sciences COSC 111 Final Exam Winter Term II Instructor: Dr. Bowen Hui. Tuesday, April 19, 2016

Spring 2017 CS 1110/1111 Exam 1

CSEN202: Introduction to Computer Science Spring Semester 2017 Midterm Exam

(the bubble footer is automatically inserted into this space)

CSE 20. SAMPLE FINAL Version A Time: 180 minutes. The following precedence table is provided for your use:

UNIVERSITY OF TORONTO FACULTY OF APPLIED SCIENCE AND ENGINEERING

COS 126 Midterm 1 Written Exam Fall 2011

Final Exam. Name: Student ID Number: Signature:

CS 1301 Exam 1 Spring 2011

CS 1063 Introduction to Computer Programming Midterm Exam 2 Section 1 Sample Exam

CSCE 206: Structured Programming in C++

Control Flow: Loop Statements

CS 3114 Data Structures and Algorithms Test 1 READ THIS NOW!

CSE 123: Computer Networks Fall Quarter, 2013 MIDTERM EXAM

York University. AP/ITEC Section M INTRODUCTION TO DATA STRUCTURES Winter Midterm Test

The American University in Cairo Department of Computer Science & Engineering CSCI &09 Dr. KHALIL Exam-I Fall 2011

The Program Specification:

Exam 2. Programming I (CPCS 202) Instructor: M. G. Abbas Malik. Total Marks: 40 Obtained Marks:

Multiple Choice (Questions 1 14) 28 Points Select all correct answers (multiple correct answers are possible)

Do not start the test until instructed to do so!

CS111: PROGRAMMING LANGUAGE II

CSE 1223: Exam II Autumn 2016

Solution printed. Do not start the test until instructed to do so! CS 2504 Intro Computer Organization Test 2 Spring 2006.

Spring 2017 CS 1110/1111 Exam 2

CSCI 135 Exam #1 Fundamentals of Computer Science I Fall 2012

ECE 2035 Programming HW/SW Systems Spring problems, 5 pages Exam Three 8 April Your Name (please print clearly)

CS 2505 Computer Organization I Test 2. Do not start the test until instructed to do so! printed

New York University Introduction to Computer Science Exam Sample Problems 2013 Andrew I. Case. Instructions:

CS150 Sample Final. Name: Section: A / B

CS 2604 Minor Project 1 DRAFT Fall 2000

Problem Score Max Score 1 Syntax directed translation & type

Do not start the test until instructed to do so!

CS 1044 Programming in C++ Test 1 READ THIS NOW! Failure to read and follow the instructions below may result in severe penalties.

Practice Midterm 1. Problem Points Score TOTAL 50

Exam Datastrukturer. DIT960 / DIT961, VT-18 Göteborgs Universitet, CSE

ECE 2035 Programming HW/SW Systems Fall problems, 4 pages Exam Three 14 November Your Name (please PRINT clearly) Signed.

Solution READ THIS NOW! CS 3114 Data Structures and Algorithms

University of Maryland College Park Dept of Computer Science CMSC106 Fall 2016 Midterm I

Activity 7: Arrays. Content Learning Objectives. Process Skill Goals

CS 2506 Computer Organization II Test 1

Exam 2. CSI 201: Computer Science 1 Fall 2016 Professors: Shaun Ramsey and Kyle Wilson. Question Points Score Total: 80

READ THIS NOW! Do not start the test until instructed to do so!

Do not start the test until instructed to do so!

CS 1331 Fall 2016 Exam 2

CIS 110 Introduction To Computer Programming. February 29, 2012 Midterm

CMSC330 Spring 2014 Midterm #2. Score 1 OCaml types & type

Programming Standards: You must conform to good programming/documentation standards. Some specifics:

CIS 1068 Design and Abstraction Spring 2017 Midterm 1a

CS 1044 Program 6 Summer I dimension ??????

CS 2506 Computer Organization II Test 2

CS 2506 Computer Organization II

Section Handout #5: Arrays

Transcription:

CSE 131S Introduction to Computer Science Summer SON 2014 Exam I Given: 1 July 2014 Due: End of live session This exam is closed-book, closed-notes, no electronic devices allowed except for downloading the exam and sending the completed exam. The exception is the cheat sheet on which you may have notes to consult during the exam. Your workmustbelegible. Work that isdifficulttoread willreceive nocredit. Donot dwell over punctuation or exact syntax in code; however, be sure to indent your code to show its structure. You must sign the pledge below for your exam to count. Any cheating will cause the students involved to receive an F for this course. Other action may be taken. You must fill in your identifying information correctly. To submit your exam, mail the scanned pages to roncytron@gmail.com. Print clearly the following information: Name (print clearly): Student 6-digit ID (print really clearly): Problem Possible Received Number Points Points 1 20 2 30 3 25 4 25 Total 100 Pledge: On my honor, I have neither given nor received any unauthorized aid on this exam. Signed: (Be sure you filled in your information in the box above!)

CSE 131S (Exam I) 2 Due by End of live session 1. (20 points) (a) (10 points) Circle the correct type for each expression in the table below, and state the result of evaluating the expression: Expression Type Result 1.0 / 2 double int boolean String true false double int boolean String "100" + (30+1) double int boolean String "d" + (7/8) + "od" double int boolean String (3/2 <= 1) + "ly" double int boolean String (b) (4 points) Below draw the expression tree for the expression 1+(2 3) 4 (c) (1 points) What is the above expression s value?

CSE 131S (Exam I) 3 Due by End of live session (d) (5 points) c d b / a * + Complete the blanks below regarding the tree shown above, which uses the aritmethic operators +,, and /: The The operator is the first operation to execute. operator is the last operation to execute. 2. (30 points) (a) (10 points) Complete the code below so that it prints true if a is at least as large as the sum of b and c. Otherwise it should print false. int a = ap.nextint("value for a?"); int b = ap.nextint("value for b?"); int c = ap.nextint("value for c?"); Continued on next page...

CSE 131S (Exam I) 4 Due by End of live session (b) (10 points) Complete the code below so that it prints the sum of N random numbers, with each random number chosen by a call to Math.random(). Do not use any arrays! int N = ap.nextint("how many random numbers?"); (c) (10 points) Complete the code below so that it prints the minimum of N random numbers, with each random number chosen by a call to Math.random(). Do not use any arrays! int N = ap.nextint("how many random numbers?"); 3. (25 points) Consider the following code, which is the basis for all parts of this question: int N = ap.nextint(); // prompt for N double[] nums = new double[n]; for (int i=0; i < N; ++i) { double r = 1.5 * Math.random(); nums[i] = r; } (a) (8 points) Consider the following values: 2.0 1.0 0.5 0.0 0.5 1.0 1.5 2.0 Circle all of the values above that could possibly be assigned to r as the above code executes. Continued on next page...

CSE 131S (Exam I) 5 Due by End of live session (b) (17 points) Suppose we are interested in the number of values placed in the array nums that have value at or below 0.5. This array has already been computed, as shown on the preceding page. Do not recompute it! Below, you write code that executes after the code shown on the previous page. Declare and initialize a variable named count and write code below the declaration so that when your code is over, count is the number of elements in nums that have value at or below 0.5. Do not print anything out. For example, if the array had the values 0.6, 0.4, 0.6, and 0.5, then your code should compute count as 2.

CSE 131S (Exam I) 6 Due by End of live session 4. (25 points) (a) (12 points) Your task here is to create a String array of 1000 elements, where each element is randomly assigned one of the following Strings: "heads" "tails" Your score will depend on correct instantiation of the array and code that should, on average, cause equal numbers of each of the above Strings to populate the array. Continued on next page...

CSE 131S (Exam I) 7 Due by End of live session (b) (8 points) Having computed the above array, below you will write code that will randomly change your array by replacing some of the entries with the string "side". Write your code so that, on average, 1 in 100 of the entries will be randomly changed from whatever they were before to "side". (c) (5 points) Now take your array and write code to iterate over it, to compute String tosses as the concatenation of its elements, in the order in which they occur in the array. It is not necessary to put any blank spaces between the entries as you concatentate them.