Faculty of Science COMP-202A - Introduction to Computing I (Fall 2009) - All Sections Midterm Examination

Similar documents
Faculty of Science COMP-202B - Introduction to Computing I (Winter 2010) - All Sections Midterm Examination

Faculty of Science COMP-202A - Foundations of Computing (Fall 2012) - All Sections Midterm Examination

COMP-202B - Introduction to Computing I (Winter 2011) - All Sections Example Questions for In-Class Quiz

Faculty of Science COMP-202A - Introduction to Computing I (Fall 2009) - All Sections Final Examination

Faculty of Science COMP-202A - Foundations of Computing (Fall 2013) - All Sections Midterm Examination

Faculty of Science Midterm. COMP-202B - Introduction to Computing I (Winter 2008)

Faculty of Science COMP-202A - Introduction to Computing I (Fall 2008) Midterm Examination

Faculty of Science COMP-202A - Introduction to Computing I (Fall 2008) Final Examination

Faculty of Science COMP-202A - Foundations of Computing (Fall 2013) - All Sections Midterm Examination

Faculty of Science COMP-202A - Introduction to Computing I (Fall 2011) - All Sections Midterm Examination

Faculty of Science COMP-202B - Introduction to Computing I (Winter 2009) Midterm Examination

Faculty of Science COMP-202A - Foundations of Computing (Fall 2015) - All Sections Midterm Examination

Faculty of Science COMP-202A - Introduction to Computing I (Fall 2010) - All Sections Final Examination

Faculty of Science COMP-202B - Introduction to Computing I (Winter 2009) - All Sections Final Examination

Faculty of Science COMP-202B - Foundations of Computing (Winter 2016) - All Sections Midterm Examination

CSC Algorithms and Data Structures I. Midterm Examination February 25, Name:

CSC 1051 Algorithms and Data Structures I. Midterm Examination February 25, Name: KEY A

CSC 1051 Algorithms and Data Structures I. Midterm Examination October 11, Name: KEY

CSC 1051 Algorithms and Data Structures I. Midterm Examination October 6, Name:

CSC 1051 Algorithms and Data Structures I. Midterm Examination October 7, Name:

CSC 1051 Algorithms and Data Structures I. Midterm Examination October 9, Name: KEY

Midterm Exam 2 Thursday, November 15th, points (15% of final grade) Instructors: Jim Williams and Marc Renault

CSC 1051 Algorithms and Data Structures I. Midterm Examination February 26, Name: Key

Computer Science is...

COMP-202 Unit 4: Programming With Iterations. CONTENTS: The while and for statements

Object-Oriented Programming

COMP102: Test. 26 April, 2006

M105: Introduction to Programming with Java Midterm Examination (MTA) Makeup Spring 2013 / 2014

McGill University School of Computer Science COMP-202A Introduction to Computing 1

Last Class. While loops Infinite loops Loop counters Iterations

CIS 1068 Design and Abstraction Spring 2017 Midterm 1a

Methods CSC 121 Fall 2016 Howard Rosenthal

Full file at

CSC 1051 Algorithms and Data Structures I. Midterm Examination March 1, Name: KEY A

12. Numbers. Java. Summer 2008 Instructor: Dr. Masoud Yaghini

CSC 1051 Algorithms and Data Structures I. Midterm Examination March 2, Name:

Computational Expression

Methods CSC 121 Spring 2017 Howard Rosenthal

Midterm Examination (MTA)

DUBLIN CITY UNIVERSITY

Primitive Data Types: Intro

Mathematical Functions, Characters, and Strings. CSE 114, Computer Science 1 Stony Brook University

To define methods, invoke methods, and pass arguments to a method ( ). To develop reusable code that is modular, easy-toread, easy-to-debug,

Faculty of Science COMP-202B - Foundations of Computing (Winter 2016) - All Sections Final Examination

Faculty of Science COMP-202A - Foundations of Computing (Fall 2014) - All Sections Final Examination

CS110: PROGRAMMING LANGUAGE I

COMP 202. Built in Libraries and objects. CONTENTS: Introduction to objects Introduction to some basic Java libraries string

DUBLIN CITY UNIVERSITY

Faculty of Science COMP-202B - Introduction to Computing I (Winter 2011) - All Sections Final Examination

The Math Class (Outsource: Math Class Supplement) Random Numbers. Lab 06 Math Class

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

double float char In a method: final typename variablename = expression ;

Using Java Classes Fall 2018 Margaret Reid-Miller

Text User Interfaces. Keyboard IO plus

CEN 414 Java Programming

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

CS 112 Introduction to Programming

CS115 Principles of Computer Science

CIS 1068 Program Design and Abstraction Spring2016 Midterm Exam 1. Name SOLUTION

Chapter 5 Methods. Modifier returnvaluetype methodname(list of parameters) { // method body; }

Chapter 6 Methods. Dr. Hikmat Jaber

H212 Introduction to Software Systems Honors

JAVA Programming Concepts

static int min(int a, int b) Returns the smaller of two int values. static double pow(double a,

Mathematical Functions, Characters, and Strings. CSE 114, Computer Science 1 Stony Brook University

4. Java Project Design, Input Methods

Benefits of Methods. Chapter 5 Methods

Oct Decision Structures cont d

Chapter 5 Methods. Lecture notes for computer programming 1 Faculty of Engineering and Information Technology Prepared by: Iyad Albayouk

int: integers, no fractional part double: floating-point numbers (double precision) 1, -4, 0 0.5, , 4.3E24, 1E-14

Programming with Java

2/9/2012. Chapter Four: Fundamental Data Types. Chapter Goals

Chapter 2. Elementary Programming

Wentworth Institute of Technology. Engineering & Technology WIT COMP1000. Java Basics

CS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University

Section 2: Introduction to Java. Historical note

Object Oriented Programming. Java-Lecture 1

COMP 202 Java in one week

Computer Science 300 Sample Exam Today s Date 100 points (XX% of final grade) Instructor Name(s) (Family) Last Name: (Given) First Name:

ASSIGNMENT 1 Expressions, Data Types, and Simple Calculations

Final Exam Practice. Partial credit will be awarded.

Chapter 5 Methods. Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved.

INTRODUCTION TO C++ FUNCTIONS. Dept. of Electronic Engineering, NCHU. Original slides are from

Place your name tag here

Chapter 5 Methods. Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved.

St. Edmund Preparatory High School Brooklyn, NY

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals

Final Exam. COMP Summer I June 26, points

AP CS Unit 3: Control Structures Notes

Using APIs. Chapter 3. Outline Fields Overall Layout. Java By Abstraction Chapter 3. Field Summary static double PI

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

Input. Scanner keyboard = new Scanner(System.in); String name;

Chapter 4 Fundamental Data Types. Big Java by Cay Horstmann Copyright 2009 by John Wiley & Sons. All rights reserved.

AP Computer Science. Return values, Math, and double. Copyright 2010 by Pearson Education

Fundamentals of Programming Data Types & Methods

CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O

Chapter 5 Methods / Functions

Activity 4: Methods. Content Learning Objectives. Process Skill Goals

Question: Total Points: Score:

COSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan

Transcription:

First Name: Last Name: McGill ID: Section: Faculty of Science COMP-202A - Introduction to Computing I (Fall 2009) - All Sections Midterm Examination Tuesday, November 3, 2009 Examiners: Mathieu Petitpas [Sections 1 and 3] 18:30 20:30 Kamal Zellag [Section 2] Instructions: DO NOT TURN THIS PAGE UNTIL INSTRUCTED This is a closed book midterm examination; notes, slides, textbooks, and other forms of documentation are not allowed. Non-programmable calculators are allowed (though you should not need one). Computers, PDAs, cell phones, and other electronic devices are not allowed. Answer all questions on this examination paper and return it. If you need additional space, use page 18 or the booklets supplied and clearly indicate where each question is continued. In order to receive full marks for a question, you must show all work. This midterm examination has 20 pages including this cover page, and is printed on both sides of the paper. Pages 19-20 contain information about useful classes and methods. 1 2 3 4 Subtotal /6 /6 /4 /4 /20 5 6 Subtotal /15 /15 /30 7 8 Subtotal /15 /35 /50 Total /100 1

COMP-202A - Fall 2009 - Midterm Examination Page 2 Section 1 - Short Questions [6] 1. In one or two sentences, explain the main differences between the concepts in each of the following pairs. BE BRIEF; overly long answers will be grounds for mark deductions. (a) An if statement and a while statement (b) The && operator and the operator (c) Formal parameters and actual parameters

COMP-202A - Fall 2009 - Midterm Examination Page 3 [6] 2. What will be displayed to the screen after each of the following code fragments is executed? For full marks, describe BRIEFLY with a few words and a value what happens at intermediate steps. (a) int a = 5; int b = a % 2; double c = a / 10; double d = b + 2.5; double e = (int)d * 3; System.out.println("c == " + c + ", e == " + e); (b) int[] a1 = {5, 10, 20, 0; int[] a2 = a1; a2[0] = 3; boolean b = a1[1] + a1[2] == a1[0] + a1[3]; System.out.println(a1[1] + a1[2] + " == " + a1[0] + a1[3] + ": " + b);

COMP-202A - Fall 2009 - Midterm Examination Page 4 [4] 3. The following program prints a shape to the screen using the character *. Describe what shape it is and what its dimensions are. You can also draw the program s exact output for full marks. public class MysteryShape { public static void main(string[] args) { final int SIZE = 15; final int HALF_SIZE = SIZE / 2; int side; for (int i = 0; i < SIZE; i++) { if (i <= HALF_SIZE) { side = i; else { side = SIZE - (i + 1); for (int j = 0; j < SIZE; j++) { if (HALF_SIZE - side <= j && j <= HALF_SIZE + side) { System.out.print("*"); else { System.out.print(" "); System.out.println();

COMP-202A - Fall 2009 - Midterm Examination Page 5 [4] 4. Consider the swap() method, declared in the following Swapper class: public class Swapper { public static void swap(int a, int b) { int temp; temp = a; a = b; b = temp; public static void main(string[] args) { int v1 = 3; int v2 = 4; System.out.println("Swapping..."); swap(v1, v2); System.out.println("v1 s new value: " + v1); System.out.println("v2 s new value: " + v2); The above swap() method above is intended to swap the values of the actual parameters passed to the method. For example, suppose the swap() method works as intended, and the main() method is executed; after the call to the swap() method, the value stored in variable v1 should be 4 (that is, the value that was stored in variable v2 before the call to the swap() method), while the value stored in variable v2 should be 3 (that is, the value that was stored in variable v1 before the call to the swap() method). Does the above swap() method work as it is intended to? That is, will it effectively swap the values of the actual parameters? BRIEFLY explain your answer. Total marks for Section 1: 20

COMP-202A - Fall 2009 - Midterm Examination Page 6 Section 2 - Long Questions [15] 5. Consider the following program: public class TraceMe { public static int trace(int[] a) { int m, c, mc, i; 1 m = a[0]; 2 c = 1; 3 mc = 1; 4 i = 1; 5 while (i < a.length) { 6 if (a[i] == a[i - 1]) { 7 c = c + 1; 8 if (c > mc) { 9 m = a[i]; 10 mc = c; else { 11 c = 1; 12 i = i + 1; 13 return m; public static void main(string[] args) { 14 int[] array = {2, 3, 3; int v; 15 v = trace(array); 16 System.out.println("v: " + v); Trace this program by writing down a list of the statements which will be executed, in the same order as that in which the statements will be executed. Each statement must be included on your list exactly as many times as it is executed. Use the numbers to the left of each statement to indicate which statement is executed. To do this correctly, write your answer using a 2-column format. For each row, the first column contains the statement number of the statement being executed, and the second column contains the following information, according to the type of the statement: If the statement is an assignment statement: the variable whose value is being changed, and its new value. If the statement is a control flow construct (if or while): the value to which the boolean expression controlling it evaluates. If the statement is a call to the print() or println() method: The String which is displayed on the screen as a result of the call.

COMP-202A - Fall 2009 - Midterm Examination Page 7 If the statement is a call to the trace() method: the word CALL, followed by the name of the method, as well as each of the formal parameters this method accepts and the actual values that are passed to each parameter for this call. If the statement is a return statement: the word RETURN, followed by the value to which the expression following the statement evaluates. As an example, here are the first five lines of the answer (you do not need to write these lines in your solution): 14 array {2, 3, 3 15 CALL trace(a {2, 3, 3) 1 m 2 2 c 1 3 mc 1 CONTINUE THE TRACE UNTIL THE PROGRAM TERMINATES:

COMP-202A - Fall 2009 - Midterm Examination Page 8 [15] 6. Consider the following program, saved in a file called Minimum.java: 1 import java.util.scanner; 2 3 public class Minimum { 4 public static int minimum(int[] a) { 5 int minsofar; 6 7 minsofar = a[0]; 8 for (int i = 1; i <= a.length; i++) { 9 if (a[i] > minsofar) { 10 minsofar = a[i]; 11 12 13 return minsofar; 14 15 16 public static void main(string[] foo) { 17 Scanner keyboard = new Scanner(System.in); 18 int[] array; 19 int size; 20 int min; 21 22 System.out.print("Enter the number of values to be stored " + 23 "in the array: "); 24 size = keyboard.nextint(); 25 26 array = new int(size); 27 for (int i = 0; i < array.length; i++) { 28 System.out.print("Enter the value at position " + i + ": "); 29 array[i] = keyboard.nextint() 30 31 32 min = minimum(array); 33 System.out.println("The minimum value in the array is: " + min); 34 35 The above program is designed to determine the minimum value in an array whose values are entered by the user (the number of values in the array is intended to be equal to the size of the array, which is also entered by the user), and display this minimum value. However, there are 5 errors in the above program. Find all the errors and list them. For each error you list, you MUST include the number of the line where the error occurs, the type of error (syntactic or semantic) and a description of the error. Do not list more than 5 errors, as you will be penalized for every error in excess of 5 that you list. Note that the line numbers to the left of the above program are included solely to help you make it easier for you to list the line numbers where errors occur; they are not part of the actual program.

COMP-202A - Fall 2009 - Midterm Examination Page 9 LIST THE ERRORS YOU FIND IN THE PROGRAM HERE: Total marks for Section 2: 30

COMP-202A - Fall 2009 - Midterm Examination Page 10 Section 3 - Programming Questions [15] 7. Suppose that on the first day of each month, you save a fixed amount of money a m in a savings account with annual interest rate r y. You can calculate the amount of money in your savings account at the beginning of a given month using the following formula: ( a i = a i 1 1 + r ) m + a m 100 where a i is the amount of money in the account at the beginning of the current month a i 1 is the amount of money in the account at the beginning of the previous month r m is the monthly interest rate; it is equal to r y /12, where r y is the yearly interest rate a m is the amount being deposited in the savings account each month Note that the initial amount in the account, denoted a 1, is equal to the amount being deposited in the savings account each month (that is, a m ). For example, suppose that you decide to save $100.00 each month into a savings account with a yearly interest rate of 6% (the monthly interest rate is therefore 0.5%). At the beginning of the first month, you deposit $100.00 in the account. At the beginning of the second month, there will be $100.00 (1 + 0.005) + $100.00 = $200.50 in the account. At the beginning of the third month, there will be $200.50 (1 + 0.005) + $100.00 = $301.5025 in the account. Write a class called SavingsCalculator, which contains only a main() method that does the following: Ask the user to enter a yearly interest rate, an amount to be deposited in the saving accounts each month, as well as a number of months, and read all these values from the keyboard. The yearly interest rate and the amount being deposited in the savings account are real numbers, while the number of months is an integer. Note that the user specifies the yearly interest rate as a percent; in other words, to specify a yearly interest rate of 6%, the user will enter 6.0 or simply 6, NOT 0.06. Calculate the amount in the savings account after the number of months entered by the user has passed. Display this value, with an appropriate explanatory message. This value does not have to be formatted in any particular fashion; in particular, the number of significant digits displayed does not matter. Sample session: Enter the yearly interest rate: 6.0 Enter the amount to be deposited each month: 100.0 Enter the number of months: 3 After 3 months, there will be $301.5025 in the savings account Your program MAY assume that the values entered by the user are of the correct type and that they are in the proper range; in other words, your program does not have to handle cases where a value entered by the user is invalid in any way (such as a negative interest rate or number of months).

COMP-202A - Fall 2009 - Midterm Examination Page 11 WRITE YOUR SavingsCalculator CLASS IN THE SPACE BELOW:

COMP-202A - Fall 2009 - Midterm Examination Page 12 8. In this question, you will write parts of a program which reads lines of text from the keyboard, encrypts these lines of text, and displays the encrypted lines. The complete program consists of three methods: getposition() encrypt() main() The getposition() and encrypt() method are declared in a class called Cipher, and the main() method is declared in a class called CipherTest. This question has three parts; in each of these parts, you will write one of the above three methods. Note that none of the parts depend on the successful completion of any of the other parts. [5] Part 1: Write a public and static called getposition(), which takes as its only parameter a char representing an upper-case letter, and returns an int representing the position of this letter in the English alphabet. Note that for the purposes of this question, the first letter of the alphabet has position 0, and the positions of the other letters are adjusted accordingly; that is, the letter A has position 0, the letter B has position 1, and so on. You MAY assume that the char value this method accepts as parameter represents an upper-case letter; in other words, your method does not have to handle the case where the char value this method accepts as parameter does NOT represent an upper-case letter. Hint: Use the properties of the character codes for each letter to avoid writing 26 if statements. This method is actually much, much shorter than the space allocated for it suggests. WRITE YOUR getposition() METHOD IN THE SPACE BELOW:

COMP-202A - Fall 2009 - Midterm Examination Page 13 YOUR getposition() METHOD CONTINUED:

COMP-202A - Fall 2009 - Midterm Examination Page 14 [15] Part 2: A monoalphabetic substitution cipher is a simple but insecure scheme used to encrypt messages. In such a cipher, for each possible symbol in the original message (called the plaintext), each occurrence of this symbol is replaced by another symbol in the encrypted message (called the ciphertext). A special value called the key determines which ciphertext symbol replaces each possible plaintext symbol. Write a public and static method called encrypt(), which takes as parameters two arrays of char, and returns an array of char. The first array this method takes as parameter represents the plaintext, and the second array this method takes as parameter represents the key. For each character in the plaintext, this method will generate the corresponding ciphertext character based on the key and store this ciphertext character in a new array of char representing the ciphertext. The length of the ciphertext will be equal to the length of the plaintext. Once every character in the plaintext has been encrypted, the method will return the ciphertext. This method will only encrypt characters representing letters; characters which occur in the plaintext and which are not letters will not be encrypted, and will appear as-is in the ciphertext. To determine which ciphertext letter corresponds to a plaintext letter, determine the position of the plaintext letter in the alphabet, and retrieve the letter at the resulting position in the key. For example, each occurrence of the character A in the plaintext will be replaced by the character at position 0 in the key, each occurrence of the character B in the plaintext will be replaced by the character at position 1 in the key, and so on. Lower-case letters occuring in the plaintext will be converted to uppercase before being encrypted. The ciphertext characters will be stored in the ciphertext in the same order as the corresponding plaintext characters were stored in the plaintext. In other words, if a character is stored at position i in the plaintext, the corresponding ciphertext character will be stored at position i in the ciphertext; this is true of all characters in the plaintext. For example, the plaintext: "Hello World!" when encrypted with the key "BCDEFGHIJKLMNOPQRSTUVWXYZA" will produce the following ciphertext: "IFMMP XPSME!" You MAY assume that the length of the array representing the key is exactly 26, and that this array contains each upper-case letter exactly once. You MUST call the getposition() method you were asked to write in the previous part to calculate the position of a letter in the alphabet. You MAY assume that the getposition() method has been implemented correctly, even if you did not successfully complete the previous part. Hint: Use the methods of the Character class to verify whether a character represents a letter, determine the case of a letter, or to convert a letter to its uppercase or lowercase equivalent. See the Summary of Java Standard Library Methods at the end of this examination for more details on the methods of the Character class.

COMP-202A - Fall 2009 - Midterm Examination Page 15 WRITE YOUR encrypt() METHOD IN THE SPACE BELOW:

COMP-202A - Fall 2009 - Midterm Examination Page 16 [15] Part 3: Write a class called CipherTest, which contains only a main() method that does the following: Ask the user to enter the plaintext. Ask the user to enter the key; you MAY assume that the key entered by the user is 26 characters long, and contains each upper-case letter exactly once. Encrypt the plaintext using the key, using the encryption scheme described in the previous part. Display the resulting ciphertext. Ask whether to encrypt another plaintext using another key. If the user answers "y", "Y", "yes", "YES", or any other meaningful combination of these letters such as "YeS", then the program will repeat the steps listed above, otherwise it will terminate. You MUST call the encrypt() method you were asked to write in the previous part to encrypt the plaintext entered by the user using the key entered by the user. You MAY assume that the encrypt() method has been implemented correctly, even if you did not successfully complete the previous part. Remember that the encrypt() method is declared in the Cipher class, NOT the CipherTest class. Hints: Read the plaintext and key entered by the user as Strings, and convert these Strings to arrays of char using the tochararray() method. You can call this method as follows: a = s.tochararray(); where s is the name of the String variable containing the String you want to convert, and a is the name of a variable of type char[] in which you want to store the array resulting from the conversion. You can display the contents of an array of char by passing the array variable to the print() or println() method. For example, the statement System.out.println(charArray); where chararray is an array of char whose contents is { H, i,!, will result in the following being displayed: Hi! In other words, you do NOT have to display the contents of an array of char one character at a time using a loop. WRITE YOUR CipherTest CLASS IN THE SPACE BELOW:

COMP-202A - Fall 2009 - Midterm Examination Page 17 YOUR CipherTest CLASS CONTINUED: Total marks for Section 3: 50 Total marks: 100

COMP-202A - Fall 2009 - Midterm Examination Page 18 USE THIS PAGE IF YOU NEED ADDITIONAL SPACE. CLEARLY INDICATE WHICH QUESTION(S) YOU ARE ANSWERING HERE.

COMP-202A - Fall 2009 - Midterm Examination Page 19 SUMMARY OF JAVA STANDARD LIBRARY METHODS FOR SELECTED CLASSES String (package java.lang) Methods: public boolean equals(object anobject): Compares this String to anobject. public boolean equalsignorecase(string anotherstring): Compares, ignoring case considerations, this String to anotherstring. public int compareto(string anotherstring): Compares this String to anotherstring lexicographically. public char[] tochararray(): Converts this string to a new character array. Scanner (package java.util) Methods: public Scanner(InputStream source): Constructs a new Scanner that produces values scanned from the specified input stream. public double nextdouble(): Scans the next token of the input as a double. public int nextint(): Scans the next token of the input as an int. public String nextline(): Advances this Scanner past the current line and returns the input read. PrintStream (package java.io) Methods: public print(boolean b): Prints boolean value b. public print(char c): Prints char value c. public print(double d): Prints double value d. public print(int i): Prints int value i. public print(object o): Prints Object o. public print(string s): Prints String s. public println(): Terminates the current line by writing the line separator string. public println(boolean b): Prints boolean value b and then terminates the line. public println(char c): Prints char value c and then terminates the line. public println(double d): Prints double value d and then terminates the line. public println(int i): Prints int value i and then terminates the line. public println(object o): Prints Object o and then terminates the line. public println(string s): Prints String s and then terminates the line. Math (package java.lang) Methods: public static double pow(double a, double b): Returns the value of a raised to the power of b. public static double sqrt(double a): Returns the correctly rounded positive square root of double value a. public static double random(): Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0. public static double sin(double a): Returns the trigonometric sine of angle a, where a is in radians. public static double cos(double a): Returns the trigonometric cosine of angle a, where a is in radians. public static double tan(double a): Returns the trigonometric tangent of angle a, where a is in radians. public static double todegrees(double angrad): Converts angle angrad measured in radians to an approximately equivalent angle measured in degrees. public static double toradians(double angdeg): Converts angle angdeg measured in degrees to an approximately equivalent angle measured in radians. public static double exp(double a): Returns Euler s number e raised to the power of double value a. public static double log(double a): Returns the natural logarithm (base e) of double value a. public static double log10(double a): Returns the base 10 logarithm of double value a.

COMP-202A - Fall 2009 - Midterm Examination Page 20 Character (package java.lang) Methods: static boolean isletter(char ch): Determines if character ch is a letter. static boolean islowercase(char ch): Determines if character ch is a lowercase character. static boolean isuppercase(char ch): Determines if character ch is an uppercase character. static char tolowercase(char ch): Converts character ch to lowercase. static char touppercase(char ch): Converts character ch to uppercase.