jagomart
digital resources
picture1_Python Pdf 185522 | Pythonpracticequestions


 187x       Filetype PDF       File size 0.11 MB       Source: cs-courses.mines.edu


File: Python Pdf 185522 | Pythonpracticequestions
computer science 101 python practice questions start getting prepared for the python exam with this document bring questions and confusions st to class on wednesday december 1 this is not ...

icon picture PDF Filetype PDF | Posted on 01 Feb 2023 | 2 years ago
Partial capture of text on file.
                                     COMPUTER SCIENCE 101 
                                     PYTHON PRACTICE QUESTIONS 
               
              Start getting prepared for the Python Exam with this document. Bring questions and confusions 
                                                  st
              to class on Wednesday, December 1 . This is not a CSCI 101 homework assignment and 
              doing these problems will not earn you extra credit. Doing these problems will, however, help 
              you get ready for the Python exam!  
               
               
              Example True/False Questions: 
              ____ The expression 9 % 5 is equal to 4.  
              ____ Variables are case sensitive, e.g., var is different than Var. 
              ____ The concept of abstraction allows users of a function to ignore the details of the 
              function implementation. 
              ____ Underscores are allowed in variable names, but not at the beginning.  
              ____ The condition  not (A and B) evaluates to True if one or more of A and B is 
              false.  
               
               
               
              Example Fill in the Blank Questions: 
              The ____________ statement will quit a loop, i.e., stop the loop from repeating further. 
                      
              Consider the function definition: def create_user(name, age)  
                      
                     name and age are ________________________ of the function. 
                      
              A while loop exits when its condition evaluates to ________________.  
               
               
               
               
                                           
       Example Code Tracing Questions: 
       Write the output of the following snippets of code OR write “error” if there is an error. 
       Also, specify what the error is (if an error exists).  
        
       x = 'qwer' 
              for i in range(len(x)+1): 
                  x = x + '!' 
              print(x) 
        
        
        
        
        
        
        
       w = “mines.edu” 
           for c in [0, 3, 2, 1]:         
               print(c[w]) 
        
        
        
        
        
        
        
       my_list = [] 
       for i in range(8, 2, -2): 
          my_list.append(i//2) 
          i += 2 
       print(my_list) 
        
        
                     
       Example Code Writing Questions: 
       Suppose the following list is declared.  
                 bigList = [ [1, 2, 3, 4, 5], [6, 7, 8, 9], [10, 11, 12]] 
         
       Write a single Python statement that will print the value 8 from bigList. 
        
        
        
        
        
        
        
        
        
        
        
       Implement the following pseudocode. You can assume the user provides correct input. 
          -While x is not 999 
          -ask user for input 
          -print sin(x) 
          -add x to list 
          -if x is the largest value in the list, print “WOW” 
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
       Write the definition for a function called nPrint which takes in the number of times to 
       print (n) and the string to print (value), outputs value to the console n times, and then 
       returns an increment of n (i.e., n+1).  
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
       Write a function called list_stats that, given a list of numbers, prints the minimum, 
       maximum, and average of the numbers in the list.  
        
The words contained in this file might help you see if this file matches what you are looking for:

...Computer science python practice questions start getting prepared for the exam with this document bring and confusions st to class on wednesday december is not a csci homework assignment doing these problems will earn you extra credit however help get ready example true false expression equal variables are case sensitive e g var different than concept of abstraction allows users function ignore details implementation underscores allowed in variable names but at beginning condition b evaluates if one or more fill blank statement quit loop i stop from repeating further consider definition def create user name age while exits when its code tracing write output following snippets error there an also specify what exists x qwer range len print w mines edu c my list append writing suppose declared biglist single that value implement pseudocode can assume provides correct input ask sin add largest wow called nprint which takes number times n string outputs console then returns increment stats ...

no reviews yet
Please Login to review.