24a-parameter-ps-answers

24a-parameter-ps-answers - CS 106A Handout #24A July 14,...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Handout #24A CS 106A July 14, 2009 Answers to Parameter Problem Set 1. True/False questions 1a) The value of a local variable named i has no direct relationship with that of a variable named i in its caller. T 1b) The value of a parameter named x has no direct relationship with that of a variable named x in its caller. T 1c) Assigning a new value to a parameter changes the value of the corresponding variable in the caller’s argument list. F 1d) Local variables of type int are automatically initialized to 0 when a method is called. F 1e) The return statement allows methods to return more than one value. F 1f) Predicate methods always return a value of the primitive type boolean . T 2. Short answer Many beginning students find it hard to understand the relationships among variables in the different methods that make up a program. Often, students tell me that it would be easier if a particular variable name, such as total or i , always contained the same value in any part of the program in which that variable appeared. In your own words, describe
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/14/2010 for the course CS 106A taught by Professor Sahami,m during the Fall '08 term at Stanford.

Page1 / 2

24a-parameter-ps-answers - CS 106A Handout #24A July 14,...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online