Docsity

Python Programming Test Bank: Introduction to Computing and Programming, Exams of Technology

Toggle sidebar
bg1
Accredited Test Bank Solution For
Introduction to Computing and
Programming in Python 4th Edition by
Mercedes Guijarro Crouch Barbara
Ericson [All Lessons Included]
• Rapid Download
• Quick Turnaround
• Complete Chapters Provided
Complete Chapter Solution Manual
are Included (Ch.1 to Ch.17)
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f

Partial preview of the text

Download Python Programming Test Bank: Introduction to Computing and Programming and more Exams Technology in PDF only on Docsity!

Accredited Test Bank Solution For

Introduction to Computing and

Programming in Python 4th Edition by

Mercedes Guijarro Crouch Barbara

Ericson [All Lessons Included]

• Rapid Download

• Quick Turnaround

• Complete Chapters Provided

Complete Chapter Solution Manual

are Included (Ch. 1 to Ch. 17 )

Table of Contents are Given Below

1. Introduction to Computer Science and Media Computation

  • What Is Computer Science About?
  • Programming Languages
  • What Computers Understand
  • Media Computation: Why Digitize Media?
  • Computer Science for Everyone

2. Introduction to Programming

  • Programming Is About Naming
  • Programming in Python
  • Programming in JES
  • Media Computation in JES
  • Making a Program

3. Creating and Modifying Text

  • Strings: Making Strings
  • Taking Strings Apart with For
  • Making Strings from Strings: Telling Stories
  • Testing the Pieces
  • Taking String Apart, and Putting Strings Together
  • Taking Strings Apart with Indices
  • Mirroring, Reversing, and Separating Strings with Index
  • Encoding and Decoding Strings Using a Keyword Cipher
  • Taking Strings Apart by Words
  • What’s Inside a String
  • What a Computer Can Do

4. Modifying Pictures Using Loops

  • How Pictures Are Encoded
  • Manipulating Pictures
  • Changing Color Values
  • Exploring Pictures
  • Using Loops in Pictures
  • Increasing/Decreasing Red (Green, Blue)
  • Testing the Program: Did That Really Work?
  • Changing One Color at a Time
  • Making Sense of Functions
  • Creating a Sunset
  • Lightening and Darkening
  • Creating a Negative
  • Converting to Grayscale
  • Specifying Pixels by Index
  • Decreasing Volume
  • Using Array Index Notation
  • Making Sense of Functions in Sounds
  • Generating Clipping
  • Normalizing Sounds

8. Modifying Samples in a Range

  • Manipulating Different Sections of the Sound Differently
  • Splicing Sounds
  • General Clip and Copy
  • Reversing Sounds
  • Mirroring
  • On Functions and Scope

9. Making Sounds by Combining Pieces

  • Composing Sounds Through Addition
  • Blending Sounds
  • Creating an Echo
  • Revisiting Index Array Notation
  • How Sampling Keyboards Work
  • Additive Synthesis
  • Modern Music Synthesis
  • Creating Multiple Echoes
  • Creating Chords
  • Sampling as an Algorithm
  • Making Sine Waves
  • Adding Sine Waves Together
  • Checking Our Result
  • Square Waves
  • Triangular Waves
  • MP
  • MIDI

10. Building Bigger Programs

  • Designing Programs Top-Down
  • A Top-Down Design Example
  • Designing the Top-Level Function
  • Designing Programs Bottom-Up
  • Testing Your Program
  • Tips on Debugging
  • Writing the Subfunctions
  • An Example Bottom-Up Process
  • Testing the Edge Conditions
  • Finding Which Statement to Worry About
  • Seeing the Variables
  • Debugging the Adventure Game
  • Algorithms and Design
  • Connecting to Data outside a Function
  • Running Programs Outside of JES

11. Manipulating Text with Methods and Files

  • Text as Unimedia
  • Manipulating Parts of Strings
  • Files: Places to Put Your Strings and Other Stuff
  • The Python Standard Library
  • String Methods: Introducing Objects and Dot Notation
  • Lists: Powerful, Structured Text
  • Strings Have No Font
  • Opening and Manipulating Files
  • Generating Form Letters
  • Reading and Manipulating Data from the Internet
  • Scraping Information from a Web Page
  • Reading CSV Data
  • Writing Out Programs
  • More on Import and Your Own Modules
  • Adding Unpredictably to Your Program with Random
  • Reading CSV Files with a Library
  • A Sampling of Python Standard Libraries

12. Advanced Text Techniques: Web and Information

  • Networks: Getting Our Text from the Web
  • Automating Access to CSV Data
  • Accessing FTP
  • Using Text to Shift Between Media
  • Moving Information Between Media
  • Using Lists as Structured Text for Media Representations
  • Hiding Information in a Picture
  • Hiding a Sound Inside a Picture

13. Making Text for the Web

  • HTML: The Notation of the Web
  • Writing Programs to Generate HTML
  • Databases: A Place to Store Our Text
  • Making Home Pages
  • Relational Databases
  • An Example Relational Database Using HashTables
  • Working with SQL
  • Using a Database to Build Web Pages

14. Creating and Modifying Movies

  • Generating Animations
  • Working with Video Source
  • Building a Video Effect Bottom-Up

Question 1. What is the primary purpose of media digitization in media computation? A) To reduce the size of media files B) To convert media into a format that computers can process and manipulate C) To enhance the quality of media files D) To eliminate the need for storage devices Answer: B Explanation: Digitizing media converts analog media into digital form, allowing computers to process, analyze, and manipulate media data effectively. Question 2. Which programming language is specifically introduced for media computation in the book? A) Java B) C++ C) Python D) JES (Jython Environment for Students) Answer: D Explanation: JES is designed for media computation and is used in the book to help students learn programming through media manipulation. Question 3. In Python, which symbol is used to indicate a comment? A) # B) // C) /* */ D) & Answer: A Explanation: In Python, the hash symbol (#) is used to denote comments, which are ignored by the interpreter and used for explanations. Question 4. Which of the following best describes a string in programming? A) A sequence of characters treated as a single data type

B) A numerical value used for calculations C) A function that manipulates images D) A loop construct for iteration Answer: A Explanation: Strings are sequences of characters enclosed in quotes, used to represent text in programming languages like Python. Question 5. How can you create a string in Python? A) Using square brackets [ ] B) Using curly braces { } C) Using quotes " " or ' ' D) Using parentheses ( ) Answer: C Explanation: Strings in Python are created by enclosing characters within single (' ') or double (" ") quotes. Question 6. What does the 'for' loop in Python do? A) Executes a block of code repeatedly a specified number of times or over a collection of items B) Defines a function to perform tasks C) Declares a new variable D) Imports external modules Answer: A Explanation: The 'for' loop iterates over a sequence (like a list or string), executing its block of code for each item. Question 7. Which Python statement would you use to tell a story by constructing a string from other strings? A) print() B) + (concatenation operator) C) import D) def

Question 11. What is the purpose of the 'len()' function in Python? A) To find the length of a string or list B) To convert data types C) To generate random numbers D) To check if a variable exists Answer: A Explanation: 'len()' returns the number of items in a string, list, or other collections, useful for processing data. Question 12. How do you reverse a string in Python? A) Using slicing with a step of - 1, e.g., string[::-1] B) Using the reverse() method C) Using the 'reverse()' function D) Using the 'invert()' method Answer: A Explanation: Python slicing with a step of - 1 creates a reversed copy of the string. Question 13. Which of the following is a method to separate words in a string? A) split() B) join() C) strip() D) replace() Answer: A Explanation: The 'split()' method divides a string into a list of words based on whitespace or other delimiters. Question 14. What Python feature allows you to process each word in a string individually? A) Looping through the list returned by split() B) Using the 'replace()' method C) Concatenating strings

D) Using conditional statements only Answer: A Explanation: After splitting a string into words, a loop can iterate through each word for processing. Question 15. Which Python statement is used to test whether a string contains a specific word? A) 'in' operator, e.g., 'word' in string B) 'contains()' method C) 'test()' function D) 'find()' method only Answer: A Explanation: The 'in' operator checks if a substring exists within a string, returning True or False. Question 16. What is the main reason for manipulating pixel color values in images? A) To change the image resolution B) To alter the visual appearance, such as brightness or color tone C) To compress the image data D) To convert images into text files Answer: B Explanation: Modifying pixel color values changes how the image appears visually, enabling effects like brightening or color shifts. Question 17. Which color channels are typically manipulated in images? A) Red, Green, Blue (RGB) B) Cyan, Magenta, Yellow (CMY) C) Lightness, Saturation, Hue (LSH) D) Black and White only Answer: A Explanation: RGB channels represent the primary colors used in digital images, and manipulating them alters the image's color composition.

B) Remove the blue channel only C) Increase the red channel intensity D) Use only the green channel for display Answer: A Explanation: Converting to grayscale involves averaging or weighting the RGB channels so that each pixel has equal intensity across all channels. Question 22. What is the purpose of specifying a pixel by its index in an image? A) To access or modify the pixel's color values directly B) To resize the image C) To rotate the image D) To apply a filter to the entire image Answer: A Explanation: Pixel indices allow precise access to individual pixel data for manipulation or analysis. Question 23. Which technique can be used to create a red-eye effect in photos? A) Replace red pixels with darker or eye-colored pixels in the affected area B) Increase all blue pixels in the image C) Convert the image to black and white D) Add a blue border around the eye area Answer: A Explanation: Red-eye correction involves identifying and reducing overly red pixels in the eye region to restore natural eye color. Question 24. How does sepia toning affect a picture? A) Adds a warm brownish hue to give it an antique appearance B) Converts the image to black and white C) Increases the saturation of all colors D) Makes the image more colorful with vibrant hues

Answer: A Explanation: Sepia toning gives images a warm, brownish tint reminiscent of vintage photographs. Question 25. What Python conditional statement can be used to detect edges in an image? A) if pixel value differs significantly from neighboring pixels B) for loop only C) while loop only D) def statement Answer: A Explanation: Edge detection involves comparing pixel values with neighbors; significant differences indicate edges. Question 26. What is chromakey used for in image processing? A) Replacing a specific color (usually green or blue) with another image or background B) Enhancing the image resolution C) Applying a sepia tone D) Adding a border around the image Answer: A Explanation: Chromakey removes a specific background color, allowing replacement with other images or videos. Question 27. How can you add a border to an image in media computation? A) Draw a rectangle around the image edges with desired color and thickness B) Increase the image size without changing content C) Convert the image to grayscale only D) Remove all pixels at the edges Answer: A Explanation: Adding a border involves drawing a rectangle with the specified border color and width around the image edges.

D) Remove the blue channel altogether Answer: A Explanation: Increasing blue involves adding to the blue channel, ensuring it does not exceed maximum intensity. Question 32. Which of the following best describes the process of creating a sunset scene in media computation? A) Gradually changing the color palette to warm tones and adjusting brightness B) Adding a blue filter to the entire image C) Removing all red pixels from the image D) Applying a sepia filter only to the bottom half of the image Answer: A Explanation: Creating a sunset involves manipulating colors and brightness to simulate warm, sunset hues. Question 33. What is a common method to darken an image? A) Subtract a value from each pixel's color channels B) Increase the brightness of all pixels C) Convert the image to black and white only D) Remove random pixels randomly Answer: A Explanation: Darkening involves decreasing pixel color intensities uniformly or selectively. Question 34. Which technique would you use to create a negative of an image? A) Subtract each pixel's color value from the maximum (e.g., 255) B) Convert the image to sepia tone C) Increase all color channels by a fixed amount D) Rotate the image 180 degrees Answer: A Explanation: Negatives invert color values, producing a photographic negative effect.

Question 35. How do you convert a color image to grayscale in media computation? A) Set R, G, B channels to their weighted average for each pixel B) Remove all color channels C) Keep only the red channel D) Increase the saturation of all pixels Answer: A Explanation: Grayscale conversion averages or weights RGB channels to produce a monochrome image. Question 36. How can you specify a pixel in an image for modification? A) By its (row, column) index position B) By the pixel’s color name C) By the image’s filename only D) By its file size Answer: A Explanation: Pixels are addressed via their position in the image grid, enabling targeted editing. Question 37. Which of the following is an example of a conditional used in image processing? A) if pixel.color > threshold then change color B) for pixel in image C) while True: D) def process_pixel(): Answer: A Explanation: Conditionals like 'if' are used to apply effects only to certain pixels based on their properties. Question 38. What is the effect of increasing the green component in an image? A) The image appears greener, potentially altering the overall color balance B) The image becomes more bluish

Question 42. What is the main purpose of background subtraction in media processing? A) To isolate foreground objects by removing background pixels, often based on color similarity B) To enhance the background colors C) To crop the entire image to a smaller size D) To convert the image into grayscale only Answer: A Explanation: Background subtraction separates foreground from background by detecting differences in pixel values. Question 43. Which method is used to add a border around a picture? A) Draw a rectangle or line around the edges with specified color and thickness B) Resize the image to a smaller dimension C) Change the background color D) Convert to grayscale first Answer: A Explanation: Borders are added by drawing shapes or lines along the image perimeter with desired styling. Question 44. How do you adjust the brightness of an image? A) Add or subtract a constant value from each pixel's color channels B) Convert the image to black and white only C) Rotate the image D) Crop the image edges Answer: A Explanation: Brightness adjustment involves modifying pixel intensities uniformly across the image. Question 45. Which image effect involves converting a color image to shades of gray based on luminance? A) Grayscale conversion

B) Sepia toning C) Posterization D) Edge detection Answer: A Explanation: Grayscale conversion reduces the image to shades of gray, representing luminance. Question 46. How can you implement edge detection in an image? A) Compare neighboring pixel values and highlight significant differences B) Convert the image to black and white only C) Increase the red channel across all pixels D) Apply a blur filter to smooth edges Answer: A Explanation: Edge detection identifies boundaries by detecting sharp changes in pixel values. Question 47. What is the purpose of 'makePicture()' in JES? A) To create a new picture object for editing or displaying images B) To save an image to disk C) To load an existing image file D) To delete an image object Answer: A Explanation: 'makePicture()' initializes a new image or loads an existing one for processing. Question 48. Which function allows you to replace a range of colors in an image? A) range coloring or thresholding functions that set pixels within a color range to a new color B) 'split()' C) 'reverse()' D) 'save()' Answer: A