Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 838 Bytes

quiz.md

File metadata and controls

27 lines (21 loc) · 838 Bytes

CSE 143

Quiz

Week 2

  1. What is boolean zen?

  2. Does the code below have boolean zen? If not, rewrite it with boolean zen.

    if (width > 0 && width < 100 && height > 0 && height < 100) {
    	return true;
    } else {
    	return false;
    }
  3. Does the code below have boolean zen? If not, rewrite it with boolean zen.

    if (list.isEmpty() == true) {
    	return true;
    } else {
    	return false;
    }
  4. Write a method equals that takes as parameters two stacks of integers and returns true if the two stacks are equal and that returns false otherwise. To be considered equal, the two stacks would have to store the same sequence of integer values in the same order. Your method is to examine the two stacks but must return them to their original state before terminating. You may use one stack as auxiliary storage.