0% found this document useful (0 votes)
16 views8 pages

AP Computer Science Principles

The document is a comprehensive introduction to computer science, covering algorithms, programming concepts, lists, and digital media. It includes multiple-choice questions that assess understanding of key topics such as abstraction, collaboration, data representation, and file compression. The content is structured into units that progressively build knowledge in computer science fundamentals.

Uploaded by

Tahani Meraz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views8 pages

AP Computer Science Principles

The document is a comprehensive introduction to computer science, covering algorithms, programming concepts, lists, and digital media. It includes multiple-choice questions that assess understanding of key topics such as abstraction, collaboration, data representation, and file compression. The content is structured into units that progressively build knowledge in computer science fundamentals.

Uploaded by

Tahani Meraz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Unit 1: Introduction to Computer Science

1. What is the primary purpose of an algorithm?


a) To debug a program
b) To provide step-by-step instructions to solve a problem
c) To speed up the execution of code
d) To represent data in a program

2. Which of the following is an example of abstraction?


a) Writing code directly in machine language
b) Using a function to simplify repetitive code
c) Creating duplicate lines of code
d) Hardcoding all values

3. How does collaboration improve the development of programs?


a) It guarantees a program will have no bugs
b) It allows for different perspectives to solve problems
c) It eliminates the need for planning
d) It speeds up the testing phase

4. What is the binary representation of the decimal number 15?


a) 1010
b) 1100
c) 1111
d) 1001

5. Which of the following is an input to a program?


a) A displayed image on a screen
b) Clicking a button on a mouse
c) Text output from a function
d) A program printing a value

6. Which of the following best describes the purpose of a computer simulation?


a) To solve a problem faster than humans
b) To create a real-world scenario for analysis
c) To perform tasks without data
d) To develop computer hardware

7. What type of errors arise when a program does not run as expected due to incorrect logic?
a) Syntax errors
b) Run-time errors
c) Logic errors
d) Input errors
8. How does a high-level programming language differ from machine language?
a) High-level languages are understood directly by computers
b) High-level languages use abstraction and are easier for humans to read
c) High-level languages are slower to execute
d) High-level languages contain only 1s and 0s

9. What is the purpose of comments in code?


a) To make programs run faster
b) To explain the purpose of code for human readability
c) To fix errors in the program
d) To add new features

10. Which of the following is true about metadata?


a) It is always part of the code execution process
b) It describes the characteristics of data
c) It deletes unnecessary program variables
d) It compresses large amounts of information

Unit 2: Programming

11. What is the purpose of a function?


a) To reduce code duplication and improve readability
b) To make a program execute faster
c) To delete unused parts of the code
d) To create a new programming language

12. Which of the following is an example of a loop structure?


a) If x > 10, print "Yes"
b) Repeat 5 times: Move forward
c) Define: Function AddNumbers
d) x = x + 1

13. What does the following code output?

x = 2
REPEAT 3 TIMES
x = x + 2
DISPLAY x

a) 4
b) 6
c) 8
d) 10
14. Which of these represents a conditional statement?
a) REPEAT UNTIL x = 5
b) IF score > 90 THEN PRINT "A"
c) x = x + 5
d) RETURN x + y

15. What does the modulus operator (%) return?


a) The quotient of a division
b) The remainder of a division
c) The square root of a number
d) The sum of two numbers

16. A programmer needs to test a program for errors. What is this process called?
a) Debugging
b) Documentation
c) Looping
d) Abstraction

17. Which of the following best describes a variable?


a) A data structure that stores only one value
b) A placeholder for storing values that can change
c) A fixed value in a program
d) A part of the program that repeats

18. What will the following program output?

y = 10
IF y > 5 THEN
DISPLAY "High"
ELSE
DISPLAY "Low"

a) High
b) Low
c) Error
d) 10

19. How can a function make a program more efficient?


a) By simplifying code into reusable components
b) By writing redundant code
c) By using specific numbers for each problem
d) By increasing program length

20. Which of the following is an example of a syntax error?


a) Forgetting to close parentheses in a function call
b) Using incorrect logic for calculations
c) Inputting incorrect values during testing
d) Displaying unexpected results

Unit 3: Lists

21. What is a list used for in programming?


a) To perform calculations
b) To store and manage multiple values
c) To write comments in a program
d) To create conditional statements

22. How do you access the first element of a list in most programming languages?
a) list[1]
b) list[0]
c) list[first]
d) list[-1]

23. What will the following pseudocode output?

list = [5, 10, 15, 20]


DISPLAY list[2]

a) 5
b) 10
c) 15
d) 20

24. Which operation removes the last element from a list?


a) list.remove(0)
b) list.delete_last()
c) list.pop()
d) list.clear()

25. What is the length of the list [3, 6, 9, 12]?


a) 3
b) 4
c) 5
d) 6

26. What does the following code output?

list = [2, 4, 6, 8]
FOR EACH item IN list
DISPLAY item + 1

a) 2, 4, 6, 8
b) 3, 5, 7, 9
c) 1, 3, 5, 7
d) 2, 3, 4, 5

27. Which operation adds an element to the end of a list?


a) list.append(item)
b) list.add(item)
c) list.push(item)
d) list.pop(item)

28. Which list operation replaces an existing value at a specific index?


a) list.add(index, value)
b) list[index] = value
c) list.push(value)
d) list.append(value)

29. Which of the following is an example of an empty list?


a) [0]
b) []
c) [null]
d) [" "]

30. What does this program output?

nums = [10, 20, 30, 40]


nums[1] = 25
DISPLAY nums

a) [10, 25, 30, 40]


b) [10, 20, 30, 40]
c) [25, 20, 30, 40]
d) [10, 20, 25, 40]

Unit 4: Digital Media

31. How is lossless compression different from lossy compression?


a) Lossless compression removes unnecessary data
b) Lossless compression reduces file size without losing information
c) Lossless compression permanently deletes data
d) Lossless compression only applies to images

32. What happens when a sound file is sampled at a higher rate?


a) The quality decreases
b) The file size increases
c) The file becomes unreadable
d) The sound becomes distorted

33. What does the term pixel refer to?


a) The smallest unit of an image
b) A sound frequency
c) A file size
d) A compression algorithm

34. What is a common format for digital images?


a) .mp3
b) .png
c) .txt
d) .wav

35. What is the purpose of metadata in an image file?


a) To compress the image
b) To describe properties like size and resolution
c) To increase color quality
d) To add additional pixels

36. Which of the following is an example of lossy compression?


a) Saving a file as a PNG
b) Compressing an image to a JPEG format
c) Compressing a text file into a ZIP file
d) Saving a sound file in WAV format

37. Why is lossy compression often used for media files like images and audio?
a) It ensures no data is lost
b) It significantly reduces file size by removing unnecessary data
c) It improves the resolution of the media
d) It makes files more secure

38. Which file format is typically associated with lossless compression?


a) JPEG
b) PNG
c) MP3
d) MP4
39. What is the primary effect of increasing the resolution of an image?
a) It reduces the file size
b) It increases the number of pixels, improving quality
c) It compresses the file
d) It reduces the color depth

40. A sound file is sampled at 44,100 Hz. What does this mean?
a) The sound is sampled 44,100 times per minute
b) The sound is sampled 44,100 times per second
c) The sound frequency is 44,100 kHz
d) The file size will always be 44,100 MB

41. What is the purpose of bit depth in a digital sound file?


a) To determine the number of channels (stereo or mono)
b) To control the frequency of sound sampling
c) To represent the range of sound values (amplitude)
d) To describe the compression method

42. What does the RGB color model represent?


a) Three primary colors used to create digital images: Red, Green, Blue
b) A system for compressing images
c) A method of arranging pixels in a file
d) A file format for black-and-white images

43. Which of the following best describes a pixel?


a) A collection of colors in an image
b) The smallest unit of an image containing color information
c) A digital sound sample
d) A single piece of metadata

44. How does lossless compression maintain data integrity?


a) By reducing file size while allowing the original data to be perfectly reconstructed
b) By removing redundant colors in an image
c) By discarding parts of the data that are not noticeable
d) By encoding data into a compressed file with metadata

45. Which of the following file types uses lossy compression for audio?
a) WAV
b) MP3
c) FLAC
d) TXT

46. What is the main trade-off of using lossy compression for images?
a) Improved quality but slower loading times
b) Smaller file size but reduced quality
c) Higher resolution but larger file size
d) Faster compression but higher storage costs

47. A programmer compresses an image file and notices some quality is lost. Which format was
likely used?
a) BMP
b) PNG
c) JPEG
d) TIFF

48. What does increasing the sampling rate of a sound file achieve?
a) It decreases the file size
b) It increases the accuracy of the recorded sound
c) It reduces the sound quality
d) It removes background noise

49. Which of the following reduces image file size without losing any data?
a) Converting a file to a JPEG format
b) Saving a file in PNG format
c) Increasing image resolution
d) Adding metadata

50. Which of the following statements about digital media is true?


a) All media compression is lossless
b) Metadata contains additional information about media files
c) The RGB model reduces the quality of images
d) Sound sampling does not affect file size

You might also like