Intro to Computing
Intro to Computing CS 1301
Popular in Course
Popular in ComputerScienence
This 0 page Study Guide was uploaded by Alayna Veum on Monday November 2, 2015. The Study Guide belongs to CS 1301 at Georgia Institute of Technology - Main Campus taught by Staff in Fall. Since its upload, it has received 112 views. For similar materials see /class/234129/cs-1301-georgia-institute-of-technology-main-campus in ComputerScienence at Georgia Institute of Technology - Main Campus.
Reviews for Intro to Computing
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 11/02/15
CS 1301 Study Questions These are sample test problems Most actual test problems Will be just a bit easier To learn the most solve these problems using only a pencil or pen and a piece of blank paper Once you think you have them solved move to a computer and see if you were right If not learn from your mistakes Write Code 8 points Write a function showPic Which prompts the user to pick a picture using the pickAFileO file chooser and then displays it If the user picks a file that does not end in jpg or jpeg the showPic function should keep prompting the user to pick a file until they pick a valid jpeg image Remember in myro the pickAFileO function returns a filename as a string the loadPicture lename function loads a picture and the show p function displays a picture from myro import def showPic fileName pickAFileO print fileName 4 if fileName 5 l 39jpeg39 and fileName 4 l 39jpg39 print quotNot a J PEG image try againquot showPic else p loadPicturefileName showp Write Code 15 points Write a function isPalindrome aString that takes a string as a parameter and returns a boolean value The function should return True if the string parameter is a palindrome ie When read backwards it is the same like quotracecarquot or AManAPlanACAnalPAnaMA and False otherWise def isPalindrome aString Reverse the string the easy way reVString aString l You could also reverse the string the hard way reVString quotquot for i in range0lenaString reVString aStringi reVString return reVString aString Write Code 10 points Write your own version of the getPixels picture function It will return a list containing all of the pixels in a picture You may NOT use the built in getPixels function but you can use the getWidthpicture getHeightpicture and getPixelpicture xy functions def getPixelspicture pixelList for X in range0 getWidthpicture for y in range0getHeightpicture pix getPixelpicturexy pixelListappendpix returnpixelList Namespaces 8 points Review the following code aVariable 8 myVariable 15 def functionliq global aVariable myVariable 20 print 1 aVariable aVariable iq return q myVariable Answer functionl aVari able myVari able 5a After the function call at the end of the code what is the value of Answer 2 7 aVariable 723 5b What is printed to the screen when this code runs 16 5c Which variable or variables are quotovershadowedquot when execution is inside of functionl imyVariable
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'