Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan
November 25, 2017, 12:28:50 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register Chat  
Pages: [1]   Go Down
  Print  
Author Topic: Chapter 4 Quiz  (Read 10112 times)
skochan
Administrator
Hero Member
*****
Posts: 3114



« on: March 18, 2009, 10:11:58 AM »

This is a 15-question quiz:

Chapter 4 Quiz.
« Last Edit: March 20, 2009, 08:39:17 AM by skochan » Logged
l4rk
Newbie
*
Posts: 1


Rails developer hopping on the iOS train...


WWW
« Reply #1 on: April 24, 2011, 12:37:54 PM »

Quiz Question

Quote
Given

int a = 25, b = 6, c = 10;

The expression

a / b * c + a % c

has the value


My Answer

This one tripped me up, so I'm "showing my work" in the hopes it'll help someone else.

Following precedence rules, this is an equivalent expression:

((a / b) * c) + (a % c)

  • a / b = 4 using integer divsion
  • a % c = 5 modulus

So, using the actual numbers...

(4 * 10) + (5) = 45
Logged
Michel
Newbie
*
Posts: 7


« Reply #2 on: August 31, 2011, 05:27:43 AM »

@ l4rk

I was thinking the same.
Logged
estschudi
Newbie
*
Posts: 15


Email
« Reply #3 on: December 19, 2011, 09:20:21 AM »

Amazing how quickly I forget what I've read.

I got a "D"
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Entire forum contents ゥ 2009 classroomM.com. All rights reserved.