midterm-winter2003

# midterm-winter2003 - School of Computer Science - Faculty...

This preview shows pages 1–3. Sign up to view the full content.

School of Computer Science - Faculty of Science - McGill University COMP 202 - Introduction to Computing 1 Midterm exam Tuesday, February 18th, 2003 Last name First name Id number Section 1 (Ernesto Posse) 2 (Yannick Daoudi) 3 (Klaus Reinhardt) Instructions No notebooks, textbooks or calculators are allowed in this exam. Language translation dictionnaries are permitted. Answers can be given in either English or French. All answers should be written on the exam sheets. Indicate clearly where are the solutions for each question in sections 2 and 3. For section 1 (multiple choice) mark your answer in this front page. Attempt all questions. Read carefully the questions. Grading Section 1: Multiple choice Section 1 mark: / 20 Question Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 Your answer Mark / 2 / 2 / 2 / 2 / 2 / 2 / 2 / 2 / 2 / 2 Section 2: Problems Section 2 mark: / 40 Question Q1 Q2 Q3 Q4 Q5 Mark / 5 / 5 / 10 / 10 / 10 Section 3: Programming Section 3 mark: / 40 Question Q1 Q2 Mark / 20 / 20 Total: / 100

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Class Method Arguments Return type Description String charAt int i char Returns the i-th char of the given string, start- ing from 0. String length void int Returns the length of the given string. String equals String s boolean Returns true if the given string has exactly the same characters as s. Integer parseInt String s int Returns the integer corresponding to s if s has only digits as characters or -. Float parseFloat String s ﬂoat Returns the ﬂoat corresponding to s if s has only digits as characters, a decimal point, or -. Operator precedence (from higher to lower): Precedence level Operator Operation Associativity 1 ( parameters ) Parameter evaluation and method invoca- tion Left to Right ++ Postﬁx increment -- Preﬁx decrement 2 ++ Preﬁx increment Right to Left -- Preﬁx decrement + Unary plus - Unary minus ! Logical negation (NOT) 3 ( type ) Cast (type conversion) Right to Left 4 * Multiplication Left to Right / Division % Modulo (remainder) 5 + Addition Left to Right + String concatenation - Substraction 6 < Less than Left to Right <= Less than or equal to > Greater than >= Greater than or equal to 7 == Equals Left to Right != Not equal 8 Logical conjunction (AND)
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 06/28/2008 for the course COMP 202 taught by Professor Verbrugge during the Fall '07 term at McGill.

### Page1 / 10

midterm-winter2003 - School of Computer Science - Faculty...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online