merican Computer cience eague 1996í97 ll-tar Contest olutions Round è1 1. The answer shown is the only correct answer. 2*è*B-CèDè 2. The expression is

Size: px
Start display at page:

Download "merican Computer cience eague 1996í97 ll-tar Contest olutions Round è1 1. The answer shown is the only correct answer. 2*è*B-CèDè 2. The expression is"

Transcription

1 Name: chool: Div: ID: 1996í97 ll-tar Contest hort Problems Round è1 eave this box blank! 1. ëjrë BIC Expressions Write a BIC expression that is an exact translation of the following: Twice the diæerence of the product of and B and the quotient of C and D Use the fewest number of parentheses as possible. 2. ëjr, Int, rë Boolean lgebra ist all of the following choices that are equivalent to the expression è æ Bèè + Bèè + Bè èaè æ B èbè + B ècè B èdè + B èeè æ B 3. ëint, rë What Does This Program Do If the following program prints the number 9 when it is run, list all possible integer inputs to the program. 10 input : B=3 : C=1 20 if èé=bè and èècéè or èbécèè then = if èébè and èbécè then = +C 40 if èèécè and èébèè or èbécè then = -C 50 if é5 then =+2 else =+5 60 print 70 end 4. ëint, rë PreæxèPostæxèInæx Notation et è represent the unary operation ëgreatest integer less than or equal to the value of its operand." For example, the postæx expression 26 3 è è has a value of 8. Evaluate the following preæx expression: + è è * è è è è - æ

2 merican Computer cience eague 1996í97 ll-tar Contest olutions Round è1 1. The answer shown is the only correct answer. 2*è*B-CèDè 2. The expression is simpliæed by applying DeMorgan's aw twice and then the deænition of XOR: è æ Bèè + Bèè + Bè =è æ Bèèè + Bè+è + Bèè =èæbèèè æ Bè+èæ Bèè =èæbèèèbè+èbèè =èæbèè æ Bè =èæbè èeè The only choice equivalent to æ B is choice èeè. 3. We can solve this program by trying small values, say between,10 and 10, looking for inputs that cause the program to print 9. If you follow this approach, you need to be able to convince yourself that all values less than,10 and greater than 10 won't work. lternatively, work backwards, one line at a time: ine 50: fter this line is executed, must have avalue of 9. If the then were executed, must have started out equal to 7. If the else were executed, must have started out with a value of 4. ine 40: fter this line is executed, must have avalue of 4 or 7. The then is always executed because BéC. Thus, must have started out with avalue of 5 or 8. 3, 5, and 8 ine 30: fter this line is executed, must have avalue of 5 or 8. If the then were executed, then must have started out equal to 4 or 7. But these are both impossible, because must be less than B. Therefore, the then was not executed, and started out with a value of 5 or 8. ine 20: fter this line is executed, must have a value of 5 or 8. Consider a ænal value of 8. If the then were executed, started out with a value of 6. But this is impossible, since must be less than B; thus started out equal to 8. Consider a ænal value of 5. If the then were executed, then started out with a value of 3. This is OK. If the then were not executed, then start out with a value of 5. This is also OK. 4. The evaluation is as follows èa box is put around the part of the expression that is about to be evaluatedè: + è è * è è è è - æ è è 6 4 è è -2 è è è 1.5 è -2 è è è -2 è the fraction 3è5 is also acceptable + 1 è

3 Name: chool: Div: ID: 1996í97 ll-tar Contest hort Problems Round è2 eave this box blank! 5. ëjrë What Does This Program Do When the following program is run, the string ëhi mom!" is printed three times. Find all integer values that could be given as input. 10 input x : y = 7 20 if èx é 2è and èy é xè then print "hi mom!" 30 if èx é yè or èx é 5è then print "hi mom!" 40 if èx éé 0è and èx*x é 5è then print "hi mom!" 50 end 6. ëjr, Int, rë Digital Electronics Find all ordered triples that make the circuit below true. B C 7. ëint, rë Pascal fter the following program is run, what is the ænal value of a program lltar97; var a, b, c: integer; procedure two èvar c, b, a: integerè; begin a:=a-2; b:=b-1; c:=a+b; end; procedure one èvar a, b, c: integerè; begin a:=a-1; b:=b-1; c:=a+b; twoèa,b,cè; end; begin a:=20; b:=10; c:=0; while a é 0 do begin oneèa,b,cè; c:=c+1; end; end. 8. ëint, rë isp Evaluate the following expression: ècr èrevere ècdr ècdr 'èè1 2è è3 4è è5 6 7èèèèèè

4 merican Computer cience eague 1996í97 ll-tar Contest olutions Round è2 5. In order for the string to be printed three times, it must be printed in lines 20, 30, and 40. From line 20, x =1; 0;,1;,2;::: will cause the string to be printed. ll of these values will cause line 30 to print the string. In line 40, both clauses of the if must be true for the string to be printed. The clause xéé0 eliminates 0 from the possible values of x. The clause x*xé5 is true only when x=1,,1, and,2. 1,,1, and,2 6. The circuit can be represented by the Boolean lgebra expression èè æ BèèB + Cèè We could construct a truth table for this expression, but because it's an ND of three terms, it's worth trying to reason about it. The term means that must be true. This gives us 4 possible triples to consider: è1,0,0è, è1,0,1è, è1,1,0è, and è1,1,1è. The term æ B means that and B must be diæerent. This leaves just è1,0,0è and è1,0,1è. The term B + C means than either B or C must be true. This leaves just è1,0,1è. è1,0,1è 7. The table at the right shows the values of variables just after c is incremented in the main loop. a b c , , ,6 27 2,8 11,20,10,9,20 8. The evaluation goes from the inside to the outside: ècdr 'èè1 2è è3 4è è5 6 7èèè è èè3 4èè5 6 7èè ècdr 'èè3 4è è5 6 7èèè è èè5 6 7èè èrevere 'èè5 6 7èèè è èè5 6 7èè ècr 'èè5 6 7èèè è è5 6 7è è5 6 7è

5 Name: chool: Div: ID: 1996í97 ll-tar Contest hort Problems Round è3 eave this box blank! 9. ëjr, Intë Computer Number ystems Express the square of in base ëjr, Int, rë Bit tring Flicking Find all values of x, 5 bits long, that make the following expression equal to èhift-2 è10101 OR xèè XOR èrcirc-2 è11011 ND ècirc-2 xèèè 11. ëint, rë Recursive Functions Evaluate f è22è given the following: fèxè = 8 é é: x + fèx +3è whenever x is prime and larger than 2 x æ fèx, 5è whenever x is even 2 x +1 otherwise 12. ërë Data tructures If you built a binary search tree with the keystkeèin this orderè, you'd end up with a tree whose internal path length is 18. uppose that you could swap up to 2 pairs of letters èe.g., the with the ærst and the T with the Kè to insert the letters in a diæerent order èe.g., KTE,using the 2 swaps aboveè. What is the minimum internal path length a resulting tree could have

6 merican Computer cience eague 1996í97 ll-tar Contest olutions Round è3 9. We could convert the number to base 10, square it, and then convert back to base 16. lternatively, we could do all the multiplication in base 16. We'll do the latter, but take advantage of the fact that to make the multiplication simple. èa + bè 2 = a 2 +2ab + b = è è 2 = æ 800 æ = æ = = B =è70+8è 2 = æ70 æ = = 3840 Finally, = 47B Write x as abcde and simplify each side: eft side of XOR: èhift-2 è10101 OR abcdeèè èhift-2 1b1d1è 1d100 Right side of XOR: èrcirc-2 è11011 ND ècirc-2 abcdeèèè èrcirc-2 è11011 ND cdeabèè èrcirc-2 cd0abè abcd0 Now, these two values XOR'd together must equal That is, XOR abcd0 = ook at each bit, from left-to-right: 1d and the term 0000* is also acceptable 1 XOR a = 1 implies a=0 d XOR b = 0 implies b=d 1 XOR c = 1 implies c=0 0 XOR d = 0 implies d=0, and thus b=0 11. The evaluation is as follows: fè22è = 22=2 æ fè17è = 11 æ fè17è fè17è = 17 + fè20è fè20è = 20=2 æ fè15è = 10 æ fè15è fè15è = Working backwards, we have f è20è = 10æ16 = 160, f è17è = = 177, and fè22è = 11 æ 177 = The shortest internal path length occurs when the binary tree is a complete tree. With 8 nodes, the shortest internal path length is 13. uch a tree can be formed with just one swap: the K and the. èother exchanges will also produce a tree whose internal path length is 13.è 13

7 Name: chool: Div: ID: 1996í97 ll-tar Contest hort Problems Round è4 eave this box blank! 13. ëint, rë ssembly anguage What is the ænal value of C when the following program is run DC 2 B DC 50 C DC 0 TOP OD C DD =1 TORE C OD UB B TORE B UB BG END C TOP 14. ëint, rë Fs and Regular Expressions How many diæerent strings of length 5 are generated by the following regular expression: èww+è æ C æ 15. ëint, rë Data tructures Insert the nodes T KEinto a minimal heap. That is, a heap where each node is less than or equal to its two children. èthis is diæerent than the heap described in the C Category Description booklet, where nodes were greater than their children.è Draw the resulting heap.

8 merican Computer cience eague 1996í97 ll-tar Contest olutions Round è4 13. The high-level program equivalent to the program is as follows: = 2 B = 50 C = 0 TOP: C = C + 1 B = B - IF B-C é 0 THEN GOTO TOP END The following table shows the values of B and C just before the BG is executed: B C ll strings must end with an and must contain a C. Between the C and, there are zero or more 's. Before the C, there's either nothing, or some combination of and WW, for instance WW,, or WW. The complete list of 5-letter strings are as follows: C, C, C, C, WWC, WWC, and WWC Here's what the tree looks like after each letter is added: T E K T T T T K

Math 241: Calculus III Final Exam è300 points totalè Show All Work Name This test consists of 2 parts. There are 10 problems in Part I, each worth 18

Math 241: Calculus III Final Exam è300 points totalè Show All Work Name This test consists of 2 parts. There are 10 problems in Part I, each worth 18 Math 241: Calculus III Final Exam è300 points totalè Show All Work Name This test consists of 2 parts. There are 10 problems in Part I, each worth 18 points; and there are 5 problems in Part II, each worth

More information

PART I. Answer each of the following. è1è Let! u = h2;,1;,2i and! v = h3; 1;,1i. Calculate: èaè! u, 2! v èbè the dot product of! u and! v ècè! u æ! v

PART I. Answer each of the following. è1è Let! u = h2;,1;,2i and! v = h3; 1;,1i. Calculate: èaè! u, 2! v èbè the dot product of! u and! v ècè! u æ! v MATH 241: FINAL EXAM Name Instructions and Point Values: Put your name in the space provided above. Check that your test contains 14 diæerent pages including one blank page. Work each problem below and

More information

Advanced Java Concepts Unit 5: Trees. Notes and Exercises

Advanced Java Concepts Unit 5: Trees. Notes and Exercises dvanced Java Concepts Unit 5: Trees. Notes and Exercises Tree is a data structure like the figure shown below. We don t usually care about unordered trees but that s where we ll start. Later we will focus

More information

The PCAT Programming Language Reference Manual

The PCAT Programming Language Reference Manual The PCAT Programming Language Reference Manual Andrew Tolmach and Jingke Li Dept. of Computer Science Portland State University September 27, 1995 (revised October 15, 2002) 1 Introduction The PCAT language

More information

19.2 View Serializability. Recall our discussion in Section?? of how our true goal in the design of a

19.2 View Serializability. Recall our discussion in Section?? of how our true goal in the design of a 1 19.2 View Serializability Recall our discussion in Section?? of how our true goal in the design of a scheduler is to allow only schedules that are serializable. We also saw how differences in what operations

More information

Inænitely Long Walks on 2-colored Graphs Which Don't Cover the. Graph. Pete Gemmell æ. December 14, Abstract

Inænitely Long Walks on 2-colored Graphs Which Don't Cover the. Graph. Pete Gemmell æ. December 14, Abstract Inænitely Long Walks on 2-colored Graphs Which Don't Cover the Graph Pete Gemmell æ December 14, 1992 Abstract Suppose we have a undirected graph G =èv; Eè where V is the set of vertices and E is the set

More information

æ additional rules in s to recognize terminals For each x2æ, g2,, ès,xgè 2 æès,x,gè This is called a shift operation. æ pop S from stack and move into

æ additional rules in s to recognize terminals For each x2æ, g2,, ès,xgè 2 æès,x,gè This is called a shift operation. æ pop S from stack and move into CPS 140 - Mathematical Foundations of CS Dr. S. Rodger Section: LR Parsing èhandoutè LR PARSING LRèkè Parser æ bottom-up parser æ shift-reduce parser æ L means: reads input left to right æ R means: produces

More information

bè ëfind all countries C and the sum S of all of C's city populations, provided S is at least 10,000,000", SUMèPopulationè GROUP BY Co Name HAVING SUM

bè ëfind all countries C and the sum S of all of C's city populations, provided S is at least 10,000,000, SUMèPopulationè GROUP BY Co Name HAVING SUM MIDTERM CSE 232, February 2000 èopen bookè FIRSTNAME: LASTNAME: Problem 1 èsql, 20 è2,7,11èè Consider the following relations CountryèCo N ame; P opulationè and CityèCi Name; Co name; P opulationè For

More information

7/25/2016. Example: Addition of Unsigned Bit Patterns. ECE 120: Introduction to Computing. Adding Two Non-Negative Patterns Can Overflow

7/25/2016. Example: Addition of Unsigned Bit Patterns. ECE 120: Introduction to Computing. Adding Two Non-Negative Patterns Can Overflow University of Illinois at Urbana-Champaign Dept. of Electrical and Computer Engineering ECE 120: Introduction to Computing 2 s Complement Overflow and Boolean Logic Example: ddition of Unsigned Bit Patterns

More information

Math 96--Radicals #1-- Simplify; Combine--page 1

Math 96--Radicals #1-- Simplify; Combine--page 1 Simplify; Combine--page 1 Part A Number Systems a. Whole Numbers = {0, 1, 2, 3,...} b. Integers = whole numbers and their opposites = {..., 3, 2, 1, 0, 1, 2, 3,...} c. Rational Numbers = quotient of integers

More information

PYTHON- AN INNOVATION

PYTHON- AN INNOVATION PYTHON- AN INNOVATION As per CBSE curriculum Class 11 Chapter- 2 By- Neha Tyagi PGT (CS) KV 5 Jaipur(II Shift) Jaipur Region Python Introduction In order to provide an input, process it and to receive

More information

More Assigned Reading and Exercises on Syntax (for Exam 2)

More Assigned Reading and Exercises on Syntax (for Exam 2) More Assigned Reading and Exercises on Syntax (for Exam 2) 1. Read sections 2.3 (Lexical Syntax) and 2.4 (Context-Free Grammars) on pp. 33 41 of Sethi. 2. Read section 2.6 (Variants of Grammars) on pp.

More information

FAST IEEE ROUNDING FOR DIVISION BY FUNCTIONAL ITERATION. Stuart F. Oberman and Michael J. Flynn. Technical Report: CSL-TR

FAST IEEE ROUNDING FOR DIVISION BY FUNCTIONAL ITERATION. Stuart F. Oberman and Michael J. Flynn. Technical Report: CSL-TR FAST IEEE ROUNDING FOR DIVISION BY FUNCTIONAL ITERATION Stuart F. Oberman and Michael J. Flynn Technical Report: CSL-TR-96-700 July 1996 This work was supported by NSF under contract MIP93-13701. FAST

More information

School of Computing National University of Singapore CS2010 Data Structures and Algorithms 2 Semester 2, AY 2015/16. Tutorial 2 (Answers)

School of Computing National University of Singapore CS2010 Data Structures and Algorithms 2 Semester 2, AY 2015/16. Tutorial 2 (Answers) chool of Computing National University of ingapore C10 Data tructures and lgorithms emester, Y /1 Tutorial (nswers) Feb, 1 (Week ) BT and Priority Queue/eaps Q1) Trace the delete() code for a BT for the

More information

where ëvar" represents a variable and ëint" represents an integer. The productions are numbered. Grammar for CAMO: In shorter notation èmostly use ærs

where ëvar represents a variable and ëint represents an integer. The productions are numbered. Grammar for CAMO: In shorter notation èmostly use ærs CPS 140 Project 2 Spring 1998 Project Due: Tuesday, March 31, 8am 50 points The purpose of this assignment is to write a parser for the CAMO programming language èsee the project 1 handout for a description

More information

The SPL Programming Language Reference Manual

The SPL Programming Language Reference Manual The SPL Programming Language Reference Manual Leonidas Fegaras University of Texas at Arlington Arlington, TX 76019 fegaras@cse.uta.edu February 27, 2018 1 Introduction The SPL language is a Small Programming

More information

CMSC 313 Lecture 03 Multiple-byte data big-endian vs little-endian sign extension Multiplication and division Floating point formats Character Codes

CMSC 313 Lecture 03 Multiple-byte data big-endian vs little-endian sign extension Multiplication and division Floating point formats Character Codes Multiple-byte data CMSC 313 Lecture 03 big-endian vs little-endian sign extension Multiplication and division Floating point formats Character Codes UMBC, CMSC313, Richard Chang 4-5 Chapter

More information

6.1 Combinational Circuits. George Boole ( ) Claude Shannon ( )

6.1 Combinational Circuits. George Boole ( ) Claude Shannon ( ) 6. Combinational Circuits George Boole (85 864) Claude Shannon (96 2) Signals and Wires Digital signals Binary (or logical ) values: or, on or off, high or low voltage Wires. Propagate digital signals

More information

ACSL All-Star Practice, Woburn CI, (T AR) + S R = ART S + ST + AR

ACSL All-Star Practice, Woburn CI, (T AR) + S R = ART S + ST + AR ACSL All-Star Practice, Woburn CI, 2008 1 Question 1. Which is bigger: 0.11 10 or 0.000111 2? Question 2. How many boolean strings RAT S satisfy the following equation? (T AR) + S R = ART S + ST + AR Question

More information

rate name People Consult Topics name rate name People Consult Topics name

rate name People Consult Topics name rate name People Consult Topics name Midterm Examination æ Please read all instructions èincluding theseè carefully. æ There are 5 problems on the exam, with a varying number of points for each problem and subproblem for a total of 75 points.

More information

Objects and Types. COMS W1007 Introduction to Computer Science. Christopher Conway 29 May 2003

Objects and Types. COMS W1007 Introduction to Computer Science. Christopher Conway 29 May 2003 Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 Java Programs A Java program contains at least one class definition. public class Hello { public static void

More information

A Java program contains at least one class definition.

A Java program contains at least one class definition. Java Programs Identifiers Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 A Java program contains at least one class definition. public class Hello { public

More information

Name: 2 Useful Formulas Pn i=1 i = nèn+1è 2 Pn i=1 xi = xn+1,1 x,1 P Pn 1 =lnn + Oè1è 1 i=1 i i=0 = ixi x è1,xè 2 e x =1+x + x2 + x 3 2! 3! + ::: lim

Name: 2 Useful Formulas Pn i=1 i = nèn+1è 2 Pn i=1 xi = xn+1,1 x,1 P Pn 1 =lnn + Oè1è 1 i=1 i i=0 = ixi x è1,xè 2 e x =1+x + x2 + x 3 2! 3! + ::: lim 1 Exam 2 Computer Engineering 251 Santa Clara University Thursday, 23 April 1998 NAME èprintedè NAME èsignedè Login Day of Lab Session Please show all your work and circle your answers. Your grade will

More information

CIS-331 Spring 2016 Exam 1 Name: Total of 109 Points Version 1

CIS-331 Spring 2016 Exam 1 Name: Total of 109 Points Version 1 Version 1 Instructions Write your name on the exam paper. Write your name and version number on the top of the yellow paper. Answer Question 1 on the exam paper. Answer Questions 2-4 on the yellow paper.

More information

Chapter 3. Gate-Level Minimization. Outlines

Chapter 3. Gate-Level Minimization. Outlines Chapter 3 Gate-Level Minimization Introduction The Map Method Four-Variable Map Five-Variable Map Outlines Product of Sums Simplification Don t-care Conditions NAND and NOR Implementation Other Two-Level

More information

2/5/2018. Expressions are Used to Perform Calculations. ECE 220: Computer Systems & Programming. Our Class Focuses on Four Types of Operator in C

2/5/2018. Expressions are Used to Perform Calculations. ECE 220: Computer Systems & Programming. Our Class Focuses on Four Types of Operator in C University of Illinois at Urbana-Champaign Dept. of Electrical and Computer Engineering ECE 220: Computer Systems & Programming Expressions and Operators in C (Partially a Review) Expressions are Used

More information

COMP Primitive and Class Types. Yi Hong May 14, 2015

COMP Primitive and Class Types. Yi Hong May 14, 2015 COMP 110-001 Primitive and Class Types Yi Hong May 14, 2015 Review What are the two major parts of an object? What is the relationship between class and object? Design a simple class for Student How to

More information

2.6 BOOLEAN FUNCTIONS

2.6 BOOLEAN FUNCTIONS 2.6 BOOLEAN FUNCTIONS Binary variables have two values, either 0 or 1. A Boolean function is an expression formed with binary variables, the two binary operators AND and OR, one unary operator NOT, parentheses

More information

CS 320: Concepts of Programming Languages

CS 320: Concepts of Programming Languages CS 320: Concepts of Programming Languages Wayne Snyder Computer Science Department Boston University Lecture 04: Basic Haskell Continued o Polymorphic Types o Type Inference with Polymorphism o Standard

More information

where C is traversed in the clockwise direction, r 5 èuè =h, sin u; cos ui; u ë0; çè; è6è where C is traversed in the counterclockwise direction èhow

where C is traversed in the clockwise direction, r 5 èuè =h, sin u; cos ui; u ë0; çè; è6è where C is traversed in the counterclockwise direction èhow 1 A Note on Parametrization The key to parametrizartion is to realize that the goal of this method is to describe the location of all points on a geometric object, a curve, a surface, or a region. This

More information

ACSL All-Star Practice

ACSL All-Star Practice ACSL All-Star Practice By GG, DH, YL, JP, DP, HW for WCI PEG EOL May, 2012 Question 1. How many paths of length 4 are there in the following graph? Question 2. Let s add two additional functions to the

More information

CSc 520 Principles of Programming Languages. 26 : Control Structures Introduction

CSc 520 Principles of Programming Languages. 26 : Control Structures Introduction CSc 520 Principles of Programming Languages 26 : Control Structures Introduction Christian Collberg Department of Computer Science University of Arizona collberg+520@gmail.com Copyright c 2008 Christian

More information

The ray tracing software package implements an object-oriented approach to

The ray tracing software package implements an object-oriented approach to Chapter 1 RayTracing 1.1 Using the ray tracer package The ray tracing software package implements an object-oriented approach to rendering and ray tracing. The object oriented design includes base classes

More information

Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition

Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators JAVA Standard Edition Java - Basic Operators Java provides a rich set of operators to manipulate variables.

More information

II. Language Processing ystem skeletal source program preprocessor source program compiler target object assembly program assembler relocatable machin

II. Language Processing ystem skeletal source program preprocessor source program compiler target object assembly program assembler relocatable machin CP 140 - Mathematical Foundations of C Dr.. Rodger ection: The tructure of a Compiler 1.1 What is a Compiler I. Translator Deænition: program in translator program in language! for! language X X Y Examples:

More information

Le L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators

Le L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators Course Name: Advanced Java Lecture 2 Topics to be covered Variables Operators Variables -Introduction A variables can be considered as a name given to the location in memory where values are stored. One

More information

DKT 122/3 DIGITAL SYSTEM 1

DKT 122/3 DIGITAL SYSTEM 1 Company LOGO DKT 122/3 DIGITAL SYSTEM 1 BOOLEAN ALGEBRA (PART 2) Boolean Algebra Contents Boolean Operations & Expression Laws & Rules of Boolean algebra DeMorgan s Theorems Boolean analysis of logic circuits

More information

Introduction. The Quine-McCluskey Method Handout 5 January 24, CSEE E6861y Prof. Steven Nowick

Introduction. The Quine-McCluskey Method Handout 5 January 24, CSEE E6861y Prof. Steven Nowick CSEE E6861y Prof. Steven Nowick The Quine-McCluskey Method Handout 5 January 24, 2013 Introduction The Quine-McCluskey method is an exact algorithm which finds a minimum-cost sum-of-products implementation

More information

2008 The McGraw-Hill Companies, Inc. All rights reserved.

2008 The McGraw-Hill Companies, Inc. All rights reserved. 28 The McGraw-Hill Companies, Inc. All rights reserved. 28 The McGraw-Hill Companies, Inc. All rights reserved. All or Nothing Gate Boolean Expression: A B = Y Truth Table (ee next slide) or AB = Y 28

More information

LECTURE 17. Expressions and Assignment

LECTURE 17. Expressions and Assignment LECTURE 17 Expressions and Assignment EXPRESSION SYNTAX An expression consists of An atomic object, e.g. number or variable. An operator (or function) applied to a collection of operands (or arguments)

More information

COSC 320 Exam 2 Key Spring Part 1: Hash Functions

COSC 320 Exam 2 Key Spring Part 1: Hash Functions COSC 320 Exam 2 Key Spring 2011 Part 1: Hash s 1. (5 Points) Create the templated function object lessthan, you may assume that the templated data type T has overloaded the < operator. template

More information

BITWISE OPERATORS. There are a number of ways to manipulate binary values. Just as you can with

BITWISE OPERATORS. There are a number of ways to manipulate binary values. Just as you can with BITWISE OPERATORS There are a number of ways to manipulate binary values. Just as you can with decimal numbers, you can perform standard mathematical operations - addition, subtraction, multiplication,

More information

Practical Questions CSCA48 Winter 2018 Week 11

Practical Questions CSCA48 Winter 2018 Week 11 Practical Questions CSCA48 Winter 2018 Week 11 Here are some questions on heaps similar to the ones in class. Make sure you are confident with them. Letters are ordered alphabetically. That is, A < B

More information

Lecture 4 CSE July 1992

Lecture 4 CSE July 1992 Lecture 4 CSE 110 6 July 1992 1 More Operators C has many operators. Some of them, like +, are binary, which means that they require two operands, as in 4 + 5. Others are unary, which means they require

More information

CIS-331 Fall 2013 Exam 1 Name: Total of 120 Points Version 1

CIS-331 Fall 2013 Exam 1 Name: Total of 120 Points Version 1 Version 1 1. (24 Points) Show the routing tables for routers A, B, C, and D. Make sure you account for traffic to the Internet. NOTE: Router E should only be used for Internet traffic. Router A Router

More information

Medium Term Plan Year 6: Autumn Term

Medium Term Plan Year 6: Autumn Term Medium Term Plan Year 6: Autumn Term Block A1.a: Multiply integers and decimals by 10, 100 or 1000 AUTUMN TERM Block A1.b: Divide integers by 10, 100 or 1000, and divide decimals by 10 or 100 Block A1.c:

More information

CmpSci 187: Programming with Data Structures Spring 2015

CmpSci 187: Programming with Data Structures Spring 2015 CmpSci 187: Programming with Data Structures Spring 2015 Lecture #9 John Ridgway February 26, 2015 1 Recursive Definitions, Algorithms, and Programs Recursion in General In mathematics and computer science

More information

Logic Design: Part 2

Logic Design: Part 2 Orange Coast College Business Division Computer Science Department CS 6- Computer Architecture Logic Design: Part 2 Where are we? Number systems Decimal Binary (and related Octal and Hexadecimal) Binary

More information

Lesson 38: Conditionals #2 (W11D3)

Lesson 38: Conditionals #2 (W11D3) Lesson 38: Conditionals #2 (W11D3) Balboa High School Michael Ferraro October 28, 2015 1 / 61 Do Now In Lesson38/DoNow.java, write a method called isdivisiblebyfour() that takes an int returns the boolean

More information

Arithmetic and Bitwise Operations on Binary Data

Arithmetic and Bitwise Operations on Binary Data Arithmetic and Bitwise Operations on Binary Data CSCI 2400: Computer Architecture ECE 3217: Computer Architecture and Organization Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides

More information

ECE550 PRACTICE Midterm

ECE550 PRACTICE Midterm ECE55 PRACTICE Midterm This is a full length practice midterm exam. If you want to take it at exam pace, give yourself 75 minutes to take the entire test. Just like the real exam, each question has a point

More information

A simple syntax-directed

A simple syntax-directed Syntax-directed is a grammaroriented compiling technique Programming languages: Syntax: what its programs look like? Semantic: what its programs mean? 1 A simple syntax-directed Lexical Syntax Character

More information

Operators And Expressions

Operators And Expressions Operators And Expressions Operators Arithmetic Operators Relational and Logical Operators Special Operators Arithmetic Operators Operator Action Subtraction, also unary minus + Addition * Multiplication

More information

8. An example row consists of constants and example elements which are really domain variables.

8. An example row consists of constants and example elements which are really domain variables. CMPT-354-98.2 Lecture Notes June 9, 1998 Chapter 4 Other Relational Languages 4.1 Quer-b-Eample èqbeè 1. QBE is both a quer language and the name of a DB sstem including it. The sstem is no longer in use,

More information

CSCI 111 First Midterm Exam Fall Solutions 09.00am 09.50am, Wednesday, October 18, 2017

CSCI 111 First Midterm Exam Fall Solutions 09.00am 09.50am, Wednesday, October 18, 2017 QUEENS COLLEGE Department of Computer Science CSCI 111 First Midterm Exam Fall 2017 10.18.17 Solutions 09.00am 09.50am, Wednesday, October 18, 2017 Problem 1 (10 points) The following C++ program has errors

More information

Will introduce various operators supported by C language Identify supported operations Present some of terms characterizing operators

Will introduce various operators supported by C language Identify supported operations Present some of terms characterizing operators Operators Overview Will introduce various operators supported by C language Identify supported operations Present some of terms characterizing operators Operands and Operators Mathematical or logical relationships

More information

Medium Term Plan Year 4

Medium Term Plan Year 4 Wk Unit Strands Objectives 1 Block B2.c: Classify and sketch 2D shapes according to the concept of symmetry Rehearse the concept of line symmetry Classify polygons according to their lines of symmetry

More information

This book is licensed under a Creative Commons Attribution 3.0 License

This book is licensed under a Creative Commons Attribution 3.0 License 6. Syntax Learning objectives: syntax and semantics syntax diagrams and EBNF describe context-free grammars terminal and nonterminal symbols productions definition of EBNF by itself parse tree grammars

More information

Combinational Logic & Circuits

Combinational Logic & Circuits Week-I Combinational Logic & Circuits Spring' 232 - Logic Design Page Overview Binary logic operations and gates Switching algebra Algebraic Minimization Standard forms Karnaugh Map Minimization Other

More information

CSE332 Summer 2010: Final Exam

CSE332 Summer 2010: Final Exam CSE332 Summer 2010: Final Exam Closed notes, closed book; calculator ok. Read the instructions for each problem carefully before answering. Problems vary in point-values, difficulty and length, so you

More information

Read this before starting!

Read this before starting! Points missed: Student's Name: Total score: /100 points East Tennessee State University Department of Computer and Information Sciences CSCI 2150 (Tarnoff) Computer Organization TEST 1 for Spring Semester,

More information

CS Bootcamp Boolean Logic Autumn 2015 A B A B T T T T F F F T F F F F T T T T F T F T T F F F

CS Bootcamp Boolean Logic Autumn 2015 A B A B T T T T F F F T F F F F T T T T F T F T T F F F 1 Logical Operations 1.1 And The and operator is a binary operator, denoted as, &,, or sometimes by just concatenating symbols, is true only if both parameters are true. A B A B F T F F F F The expression

More information

ACSL All-Star Practice

ACSL All-Star Practice ACSL All-Star Practice By BB, GG, JP and DP for WCI PEG, GL (KTHXBAI) May, 2011 Question 1. What is printed by the following program? 10 read D$ 20 read S$ 25 for J = len(s$) to 1 step -1 30 for K = 1

More information

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, FALL 2012

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 02, FALL 2012 CMSC 33 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 2, FALL 22 TOPICS TODAY Bits of Memory Data formats for negative numbers Modulo arithmetic & two s complement Floating point formats

More information

There are four numeric types: 1. Integers, represented as a 32 bit (or longer) quantity. Digits sequences (possibly) signed are integer literals:

There are four numeric types: 1. Integers, represented as a 32 bit (or longer) quantity. Digits sequences (possibly) signed are integer literals: Numeric Types There are four numeric types: 1. Integers, represented as a 32 bit (or longer) quantity. Digits sequences (possibly) signed are integer literals: 1-123 +456 2. Long integers, of unlimited

More information

Here is a C function that will print a selected block of bytes from such a memory block, using an array-based view of the necessary logic:

Here is a C function that will print a selected block of bytes from such a memory block, using an array-based view of the necessary logic: Pointer Manipulations Pointer Casts and Data Accesses Viewing Memory The contents of a block of memory may be viewed as a collection of hex nybbles indicating the contents of the byte in the memory region;

More information

[Y2] Counting and understanding number. [Y2] Counting and understanding number. [Y2] Counting and understanding number

[Y2] Counting and understanding number. [Y2] Counting and understanding number. [Y2] Counting and understanding number Medium Term Plan : Year 2 Autumn Term Block A1.a: Count on and back in 1s or 10s from a 2- digit number; write figures up to 100 Block A1.b: Begin to count up to 100 objects by grouping in 5s or 10s; estimate

More information

Midterm Solutions COMS W4115 Programming Languages and Translators Wednesday, March 25, :10-5:25pm, 309 Havemeyer

Midterm Solutions COMS W4115 Programming Languages and Translators Wednesday, March 25, :10-5:25pm, 309 Havemeyer Department of Computer cience Columbia University Midterm olutions COM W4115 Programming Languages and Translators Wednesday, March 25, 2009 4:10-5:25pm, 309 Havemeyer Closed book, no aids. ach question

More information

Gate Level Minimization Map Method

Gate Level Minimization Map Method Gate Level Minimization Map Method Complexity of hardware implementation is directly related to the complexity of the algebraic expression Truth table representation of a function is unique Algebraically

More information

CSE 452: Programming Languages. Outline of Today s Lecture. Expressions. Expressions and Control Flow

CSE 452: Programming Languages. Outline of Today s Lecture. Expressions. Expressions and Control Flow CSE 452: Programming Languages Expressions and Control Flow Outline of Today s Lecture Expressions and Assignment Statements Arithmetic Expressions Overloaded Operators Type Conversions Relational and

More information

Here is a C function that will print a selected block of bytes from such a memory block, using an array-based view of the necessary logic:

Here is a C function that will print a selected block of bytes from such a memory block, using an array-based view of the necessary logic: Pointer Manipulations Pointer Casts and Data Accesses Viewing Memory The contents of a block of memory may be viewed as a collection of hex nybbles indicating the contents of the byte in the memory region;

More information

Declaring Numbers. Bernd Braßel, Frank Huch and Sebastian Fischer. Department of Computer Science, University of Kiel, Germany

Declaring Numbers. Bernd Braßel, Frank Huch and Sebastian Fischer. Department of Computer Science, University of Kiel, Germany Declaring Numbers Bernd Braßel, Frank Huch and Sebastian Fischer Department of Computer Science, University of Kiel, Germany WFLP 2007, Paris, France I m going to present joint work with my colleagues

More information

CSL 201 Data Structures Mid-Semester Exam minutes

CSL 201 Data Structures Mid-Semester Exam minutes CL 201 Data tructures Mid-emester Exam - 120 minutes Name: Roll Number: Please read the following instructions carefully This is a closed book, closed notes exam. Calculators are allowed. However laptops

More information

Bits, Words, and Integers

Bits, Words, and Integers Computer Science 52 Bits, Words, and Integers Spring Semester, 2017 In this document, we look at how bits are organized into meaningful data. In particular, we will see the details of how integers are

More information

CSCE 314 TAMU Fall CSCE 314: Programming Languages Dr. Flemming Andersen. Haskell Functions

CSCE 314 TAMU Fall CSCE 314: Programming Languages Dr. Flemming Andersen. Haskell Functions 1 CSCE 314: Programming Languages Dr. Flemming Andersen Haskell Functions 2 Outline Defining Functions List Comprehensions Recursion 3 Conditional Expressions As in most programming languages, functions

More information

Prof. Navrati Saxena TA: Rochak Sachan

Prof. Navrati Saxena TA: Rochak Sachan JAVA Prof. Navrati Saxena TA: Rochak Sachan Operators Operator Arithmetic Relational Logical Bitwise 1. Arithmetic Operators are used in mathematical expressions. S.N. 0 Operator Result 1. + Addition 6.

More information

Summary of Course Coverage

Summary of Course Coverage CS-227, Discrete Structures I Spring 2006 Semester Summary of Course Coverage 1) Propositional Calculus a) Negation (logical NOT) b) Conjunction (logical AND) c) Disjunction (logical inclusive-or) d) Inequalities

More information

Chapter 7. Expressions and Assignment Statements ISBN

Chapter 7. Expressions and Assignment Statements ISBN Chapter 7 Expressions and Assignment Statements ISBN 0-321-33025-0 Chapter 7 Topics Introduction Arithmetic Expressions Overloaded Operators Type Conversions Relational and Boolean Expressions Short-Circuit

More information

1. Fill in the entries in the truth table below to specify the logic function described by the expression, AB AC A B C Z

1. Fill in the entries in the truth table below to specify the logic function described by the expression, AB AC A B C Z CS W3827 05S Solutions for Midterm Exam 3/3/05. Fill in the entries in the truth table below to specify the logic function described by the expression, AB AC A B C Z 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.

More information

APPLESHARE PC UPDATE INTERNATIONAL SUPPORT IN APPLESHARE PC

APPLESHARE PC UPDATE INTERNATIONAL SUPPORT IN APPLESHARE PC APPLESHARE PC UPDATE INTERNATIONAL SUPPORT IN APPLESHARE PC This update to the AppleShare PC User's Guide discusses AppleShare PC support for the use of international character sets, paper sizes, and date

More information

PCL Greek-8 - Code Page 869

PCL Greek-8 - Code Page 869 PCL Greek-8 - Code Page 869 Page 1 of 5 PCL Symbol Se t: 8G Unicode glyph correspondence tables. Contact:help@redtitan.com http://pcl.to $20 U0020 Space $90 U038A Ê Greek capita l letter iota with tonos

More information

Algebra 1 Summer Review Packet DUE THE FIRST DAY OF SCHOOL

Algebra 1 Summer Review Packet DUE THE FIRST DAY OF SCHOOL Name: Algebra 1 Summer Review Packet DUE THE FIRST DAY OF SCHOOL About Algebra 1: Algebra 1 teaches students to think, reason and communicate mathematically. Students use variables to determine solutions

More information

æ When a query is presented to the system, it is useful to ænd an eæcient method of ænding the answer,

æ When a query is presented to the system, it is useful to ænd an eæcient method of ænding the answer, CMPT-354-98.2 Lecture Notes July 26, 1998 Chapter 12 Query Processing 12.1 Query Interpretation 1. Why dowe need to optimize? æ A high-level relational query is generally non-procedural in nature. æ It

More information

The Arithmetic Operators. Unary Operators. Relational Operators. Examples of use of ++ and

The Arithmetic Operators. Unary Operators. Relational Operators. Examples of use of ++ and The Arithmetic Operators The arithmetic operators refer to the standard mathematical operators: addition, subtraction, multiplication, division and modulus. Op. Use Description + x + y adds x and y x y

More information

The Arithmetic Operators

The Arithmetic Operators The Arithmetic Operators The arithmetic operators refer to the standard mathematical operators: addition, subtraction, multiplication, division and modulus. Examples: Op. Use Description + x + y adds x

More information

Chapter 1 Preliminaries

Chapter 1 Preliminaries Chapter 1 Preliminaries This chapter discusses the major classes of programming languages and the relationship among them. It also discusses the binary and the hexadecimal number systems which are used

More information

IT 201 Digital System Design Module II Notes

IT 201 Digital System Design Module II Notes IT 201 Digital System Design Module II Notes BOOLEAN OPERATIONS AND EXPRESSIONS Variable, complement, and literal are terms used in Boolean algebra. A variable is a symbol used to represent a logical quantity.

More information

Comp 150 Final Exam Overview.

Comp 150 Final Exam Overview. Comp 150 Final Exam Overview. Resources During the Exam The exam will be closed book, no calculators or computers. You may bring notes on four sides of 8.5x11 inch paper (either both sides of two sheets,

More information

Binary, Hexadecimal and Octal number system

Binary, Hexadecimal and Octal number system Binary, Hexadecimal and Octal number system Binary, hexadecimal, and octal refer to different number systems. The one that we typically use is called decimal. These number systems refer to the number of

More information

MML Contest #1 ROUND 1: VOLUME & SURFACES

MML Contest #1 ROUND 1: VOLUME & SURFACES MML Contest # ROUND : VOLUME & SURFACES A) The base of a right pyramid is a square with perimeter 0 inches. The pyramid s altitude is 9 inches. Find the exact volume of the pyramid. A) The volume of a

More information

CS 5515 Fall Solution to Test è1. Open booksènotes; calculator allowed

CS 5515 Fall Solution to Test è1. Open booksènotes; calculator allowed CS 5515 Fall 1997 Solution to Test è1 Oen booksènotes; calculator allowed 1. Consider a standard DLX IntèFT ieline with 5 stages: IF, ID, EX, M and WB. The execution unit can execute æoating oint or integer

More information

Conditionals !

Conditionals ! Conditionals 02-201! Computing GCD GCD Problem: Compute the greatest common divisor of two integers. Input: Two integers a and b. Output: The greatest common divisor of a and b. Exercise: Design an algorithm

More information

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems

SCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems SCHOOL OF ENGINEERING & BUILT ENVIRONMENT Mathematics Numbers & Number Systems Introduction Numbers and Their Properties Multiples and Factors The Division Algorithm Prime and Composite Numbers Prime Factors

More information

Lecture 1. Types, Expressions, & Variables

Lecture 1. Types, Expressions, & Variables Lecture 1 Types, Expressions, & Variables About Your Instructor Director: GDIAC Game Design Initiative at Cornell Teach game design (and CS 1110 in fall) 8/29/13 Overview, Types & Expressions 2 Helping

More information

DIGITAL SYSTEM DESIGN

DIGITAL SYSTEM DESIGN DIGITAL SYSTEM DESIGN UNIT I: Introduction to Number Systems and Boolean Algebra Digital and Analog Basic Concepts, Some history of Digital Systems-Introduction to number systems, Binary numbers, Number

More information

SWITCHING THEORY AND LOGIC CIRCUITS

SWITCHING THEORY AND LOGIC CIRCUITS SWITCHING THEORY AND LOGIC CIRCUITS COURSE OBJECTIVES. To understand the concepts and techniques associated with the number systems and codes 2. To understand the simplification methods (Boolean algebra

More information

CS 275 Automata and Formal Language Theory. First Problem of URMs. (a) Definition of the Turing Machine. III.3 (a) Definition of the Turing Machine

CS 275 Automata and Formal Language Theory. First Problem of URMs. (a) Definition of the Turing Machine. III.3 (a) Definition of the Turing Machine CS 275 Automata and Formal Language Theory Course Notes Part III: Limits of Computation Chapt. III.3: Turing Machines Anton Setzer http://www.cs.swan.ac.uk/ csetzer/lectures/ automataformallanguage/13/index.html

More information

Chapter 4. Combinational Logic. Dr. Abu-Arqoub

Chapter 4. Combinational Logic. Dr. Abu-Arqoub Chapter 4 Combinational Logic Introduction N Input Variables Combinational Logic Circuit M Output Variables 2 Design Procedure The problem is stated 2 The number of available input variables & required

More information

CS345 Midterm Examination. Wednesday, May 14, 2003, 9:30 í 11:30AM. Directions. The exam is open book; any written materials may be used.

CS345 Midterm Examination. Wednesday, May 14, 2003, 9:30 í 11:30AM. Directions. The exam is open book; any written materials may be used. CS345 Midterm Examination Wednesday, May 14, 2003, 9:30 í 11:30AM Directions æ æ æ æ The exam is open book; any written materials may be used. Answer all 9 questions on the exam paper itself. The total

More information

Architecture of Compilers, Interpreters. CMSC 330: Organization of Programming Languages. Front End Scanner and Parser. Implementing the Front End

Architecture of Compilers, Interpreters. CMSC 330: Organization of Programming Languages. Front End Scanner and Parser. Implementing the Front End Architecture of Compilers, Interpreters : Organization of Programming Languages ource Analyzer Optimizer Code Generator Context Free Grammars Intermediate Representation Front End Back End Compiler / Interpreter

More information