Fundamentals of Computer Programming, Exams of Computer Science

Various fundamental concepts in computer programming, including parameters, data cleaning, scalability, text-based programming languages, machine learning, logic gates, apis, empirical analysis, program components, control structures, data patterns, bandwidth, algorithm development, internet applications, boolean logic, and data analysis. It provides insights into how these concepts are used in programming and how they contribute to the overall development and efficiency of software systems. The importance of these programming fundamentals, their practical applications, and how they can be leveraged to create more robust and effective software solutions.

Typology: Exams

2023/2024

Available from 10/25/2024

Fortis-In-Re
Fortis-In-Re šŸ‡ŗšŸ‡ø

4.2

(5)

5.4K documents

1 / 22

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
AP Computer Science Principles Q&A Verified Exam
How are procedures abstractions in computer science?
(A) They are blocks of code that do something specific.
(B) They represent the lowest level of code for the computer to run
(C) They use actual values to represent concepts.
(D) They can be used without understanding or seeing the code used. - ANS-D- We do not need to know
how a procedure works only that it does. The details are hidden or abstracted away inside the
procedure's code.
What do the parameters used in a procedure provide?
(A) A way to get values into the procedure making code more flexible
(B) A way to return values calculated in the procedure back to the calling program
(C) A way to call a procedure from within another procedure
(D) A way to connect an API to the procedure - ANS-A- Parameters allow a procedure to be more flexible
by allowing different values from the program to be sent to the procedure. The code does not have to
be re-written each time it needs to be used in the program.
What happens when you "clean data"?
(A) Corrupt data records are corrected or removed
(B) Incomplete data records are completed or removed.
(C) Duplicate records are removed.
(D) All of the above. - ANS-D- Cleaning data refers to taking raw data and checking it for errors. These
errors could be corrupt, incomplete, or duplicate data. Cleaning could include either correcting or
removing the identified data, depending on the specifications for a particular dataset.
What causes a problem to be classified as "intractable"?
(A) The solution is too inefficient for large data sets.
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16

Partial preview of the text

Download Fundamentals of Computer Programming and more Exams Computer Science in PDF only on Docsity!

AP Computer Science Principles Q&A Verified Exam

How are procedures abstractions in computer science?

(A) They are blocks of code that do something specific.

(B) They represent the lowest level of code for the computer to run

(C) They use actual values to represent concepts.

(D) They can be used without understanding or seeing the code used. - ANS-D- We do not need to know how a procedure works only that it does. The details are hidden or abstracted away inside the procedure's code.

What do the parameters used in a procedure provide?

(A) A way to get values into the procedure making code more flexible

(B) A way to return values calculated in the procedure back to the calling program

(C) A way to call a procedure from within another procedure

(D) A way to connect an API to the procedure - ANS-A- Parameters allow a procedure to be more flexible by allowing different values from the program to be sent to the procedure. The code does not have to be re-written each time it needs to be used in the program.

What happens when you "clean data"?

(A) Corrupt data records are corrected or removed

(B) Incomplete data records are completed or removed.

(C) Duplicate records are removed.

(D) All of the above. - ANS-D- Cleaning data refers to taking raw data and checking it for errors. These errors could be corrupt, incomplete, or duplicate data. Cleaning could include either correcting or removing the identified data, depending on the specifications for a particular dataset.

What causes a problem to be classified as "intractable"?

(A) The solution is too inefficient for large data sets.

(B) There is not an algorithm that can solve it.

(C) It is solved most efficiently with large data sets

(D) Multiple algorithms exist with different levels of efficiency. - ANS-A- Intractable problems may have an algorithm that can solve some or a small number of values, but as the dataset grows large, the algorithm cannot be used due to a lack of resources, either memory or storage.

What are statements, procedures, and libraries examples of?

(A) Low-level machine code that the computer uses to run the code.

(B) Abstractions used in writing software because they can be used without knowing the details of how they work

(C) Algorithms that provide suggestions on how to approach writing the code to solve a problem

(D) Pseudo code that helps design a solution for coding challenges. - ANS-B- These are some of the abstractions that can be used in writing software.

What is an issue that organizations must handle when dealing with large data sets?

(A) Ensuring enough staff are on hand to process the data

(B) Ensuring the bandwidth can handle the processing of the data

(C) Ensuring that people's private data is not exposed

(D) Ensuring the system can scale down after the data are sent to the cloud - ANS-C- organizations handling large datasets must protect the data to ensure people's private information is not accidentally revealed.

How does the Internet work with different equipment in use?

(A) The routers adjust for the different equipment manufacturers by sending data on the same equipment brands

(B) Specific companies are approved to make equipment for the Internet

(C) Vendors follow the protocols established to enable data to be sent and received across any equipment

How do selection statements determine which section of code to execute?

(A) Through the use of the Turing algorithm for analysis

(B) Through random number generators

(C) Through conditions that evaluate to true or false

(D) Through variables initialized to execute these statements - ANS-C- The code with the selection statement is executed if the Boolean condition evaluates to be true. Additional code can be executed if the condition is false using the ELSE statement.

How are list elements accessed individually?

(A) The list name plus an integer index in brackets are used.

(B) The list name is used along with the value the code needs to access

(C) The "access" command is used with the list name and length

(D) A FOR EACH loop is used with the list to find an individual value - ANS-A- Each element in a list has an associated index position, starting at 1. To access an individual element, use the list name and the index position in brackets. For example songList[4] references the fourth element in this list.

What do logical conditions always evaluate to?

(A) A Boolean value

(B) A value stored in a constant

(C) A "string" text field

(D) A real number - ANS-A- Logical conditions are in a Boolean format, meaning each condition will always evaluate to either true or false.

What is an example of a coding-related abstraction?

(A) Using comments in your code

(B) The CPU (Central Processing Unit)

(C) Pressing a button on an app

(D) A constant value - ANS-C- Pressing a button on an app is an abstraction because we do not know how or need to know the details of what happens behind the scenes once we press the button. Clicking the button initiates code for the feature a particular button represents.

What is the process where algorithms are used with historical data to attempt to predict human needs or requests for information?

(A) Data mining

(B) Trend prediction

(C) Social analysis

(D) Machine learning - ANS-D- Machine-learning algorithms learn from and make predictions based on data to improve the experience for those using it. One example is search algorithms. These often infer additional details of your search criteria, such as showing the Mustang car versus the horse if your other search criteria include automobiles.

There are many programming languages. How do computers understand different languages?

(A) Testing takes care of this for computers by confirming the correctness of the code

(B) Debugging handles this for computers by confirming the validity of the code

(C) Compilers and interpreters translate the code to machine language for computers to read

(D) There is a special natural language tied into all programming languages that all computers can read that is created behind the scenes using abstraction - ANS-C- Most programming languages are written in a high-level language that resembles natural language, such as English. This high-level code is translated to machine language that computers can then "read" and process

How is a logic gate an abstraction?

(A) It adds the detail needed for each logic condition possible

(B) It is more specific than hardware components

(C) It represents any true and false condition

(A) Sequence / Selection / Iteration

(B) Series / Procedural / Functional

(C) Connection / Collection / Recursive

(D) Selection / Sorting / Searching - ANS-A- All algorithms can be written with a combination of sequential, selection, and iterative statements.

~ Sequential statements run one after the other.

~ Selection statements are run only if the criteria are met.

~ Iterative statements repeat while a condition is being met and stops when it becomes false

What is the most common way computer viruses are spread?

(A) By people clicking on an infected file

(B) From pop-up ads

(C) Through networks worms

(D) From random botnet attacks - ANS-A- Viruses must be spread via an infected file. These are transmitted in ways to get people to click on them, and email attachments are the most common way.

What does Moore's law indicate?

(A) That the power of processors would double approximately every two years

(B) That the size of computers would decrease by half every two years

(C) That the price of computers would decrease by half every two years

(D) That the cost of computer storage would decrease by half every year - ANS-A- Moore's law indicates that the number of transistors that can fit on a circuit has doubled approximately every two years. This leads to faster processors.

How does creating program components help with program development?

(A) Individual components can be added without additional testing

(B) Adding the components incrementally to working code helps create program functionality that is correct

(C) Multiple people can write the components and still ensure compatibility

(D) The components can be combined at once to create the needed program functionality - ANS-B- Developing program components and testing them before combining them with other working, tested code helps create large correct programs.

What is the name of the search method that decides the size of the data set by two with each iteration of the search?

(A) Bucket search

(B) Merge Search

(C) Linear Search

(D) Binary Search - ANS-D- A Binary search uses the "divide and conquer" method to halve (divide by 2) the size of the data set, and continues to search the half of the data set the number could still be in. This search is very efficient, and the data set must be sorted for it to work.

How does documentation help with maintaining programs?

(A) It journals the history of program changes showing how the program fist worked before changes

(B) If the code is modified, the documentation can guide the programmer in testing to ensure the functionality is still correct

(C) It documents how to run the program in multiple languages for a global audience

(D) It is useful for training new employees on how to learn the programming language - ANS-B- By documenting what the program does, if code is changed, the programmer changing it can test to ensure the functionality is still correct.

What is the purpose of the DNS (Domain Name System)?

(A) To translate natural language website names to their IP address

(B) To create a new IP address for a website each time it is requested

(C) To position the packets in their correct order

(B) Algorithms need to be written for the patterns

(C) Abstracting out the details in the data must occur

(D) The data must be encrypted - ANS-A- Computational tools process the data in iterative ways so patterns can begin to surface.

Why should procedures be used?

(A) They ease the workload on the processors

(B) They facilitate the storage of data on hard drives

(C) They make writing and maintaining programs easier through reuse of code

(D) They control the flow of input and output data. - ANS-C- Procedures are blocks of code that can be reused making the program more readable and easier to maintain.

How should large data sets be analyzed?

(A) Using information filtering and search tools because they are efficient

(B) Using frequency analysis tools so patterns stand out

(C) Using exponential tools for faster analysis

(D) Using linear tools to see patterns as they develop - ANS-A- Efficient tools, such as information filtering and search tools, are needed to process these very large data sets.

What can help with identifying and correcting program errors?

(A) Revisiting requirements

(B) Collaboration

(C) Clustering requirements and tests

(D) Consolidating testing - ANS-B- Collaboration is the process of working with one or more individuals on an activity or task. It is an effective way to test and correct code. The collaborative efforts could occur in person or in a virtual format, such as editing a shared document stored in the cloud or a video conference.

How can financial transactions safely occur on the Internet?

(A) Through the use of symmetric keys

(B) Through certificates issued by Certificate Authorities (CAs) that validate the keys used

(C) Through the use of double authentication methods

(D) Through the use of frequency analysis - ANS-B- Certificate Authorities (CAs) issue digital certificates that allow others using a site to ensure the identity of that site is authentic.

What is the definition of bandwidth?

(A) The frequency that data can be transmitted across the Internet

(B) The speed that data can be sent through the Internet

(C) The amount of data that can be transmitted in a fixed amount of time

(D) The delay between the request and the receipt of the information on the Internet - ANS-C- Bandwidth measures how much data can be transmitted from a location to another in a given amount of time.

Which type of loop is most effective to iterate over a list?

(A) Continuous

(B) While

(C) FOR EACH

(D) Do - ANS-C- A FOR EACH loop will check each element in a list from start to end without having to specify each one individually.

What is one way to help ensure the correctness of algorithms?

(A) By testing with small sets of expected data

(B) Through the reuse of existing correct algorithms to build new algorithms

(C) Through documenting the functionality of the algorithm

(C) They effectively process all cases of input

(D) They produce accurate results - ANS-A- Readability makes code easier to understand and therefore easier to debug, maintain, and enhance.

How is collaboration useful in analyzing data sets?

(A) The multiple viewpoints can provide several outcomes for the data

(B) Applying differing experiences and skills provides better analysis and insight

(C) The analysis can be divided among several people, speeding the analysis

(D) Having multiple leaders helps the group form alliances based on interests - ANS-B- Having people with different perspectives and backgrounds helps identify new trends and potential solutions more easily than someone working alone or a homogeneous group.

When would lossless data compression be preferred over a lossy one?

(A) When you need to get back to the original file

(B) When you do not need to get back to the original file

(C) When you need to display the file on mobile devices and websites

(D) When you have limited space available on your computer - ANS-A- Lossless data compression tec hniques enable the original, uncompressed file to be restored. Lossless techniques do not provide as much compression as a lossy technique, but always select this when you may need to restore the original file.

How does cryptography enable the Internet to process transactions securely?

(A) The public key encryption model is easy to use to encrypt data but intractable to decrypt for large numbers

(B) Frequency analysis is used to disguise the use of common letters in encrypted messages keeping passwords secure

(C) Symmetric keys are used to encrypt and decrypt messages for speed in processing to avoid being intercepted

(D) Polymeric alphabets are used to encrypt and decrypt messages to allow for use with different languages. - ANS-A- A good cryptographic model is easy to use in one direction, such as encrypting data, but very difficult to do in the other direction, the decryption of the data. This means that even if the information is intercepted, someone trying to exploit it may still not be able to identify the correct encryption key used.

Why are the Boolean logic values used in computer science?

(A) Because most programs need to process both numbers and text fields

(B) Because they are used to test a program's results to ensure the output is correct

(C) Because they evaluate to true or false, which matches binary values of 0 and 1

(D) Because they are useful to determine if an instruction is running in memory - ANS-C- Boolean logic can be used at a simple level or to build more complex conditions to represent needed functionality, but always evaluate to be true or false. This is useful in computer science where at its lowest level, machine code is made up of 0s and 1s.

Given the importance of sharing insight and knowledge gained from processing data, how can this be effectively communicated?

(A) Using summaries of the insights

(B) Providing detailed examples of the data to prove the accuracy

(C) Using tables and diagrams of the findings

(D) All of the above - ANS-D- There are many effective strategies for sharing the information gained. Choosing an appropriate level of detail and presentation method based on the audience is important to clearly communicate the findings.

Why are models and simulations useful abstractions?

(A) They can test hypotheses without real-world constraints

(B) They can change multiple options at the same time, leading to new insights

(C) They can precisely test real-world events to identify the ultimate outcome

(D) They can confirm the cause of events - ANS-A- While models are usually on a smaller scale than the real-world feature they represent, they can be used to simulate actual events to see the result of

How can social media have a positive global impact?

(A) By allowing people to post their views anonymously and safely

(B) By allowing accounts of unverified events to spread quickly

(C) By providing a way for those impacted by disasters to communicate that they are safe

(D) By posting images or videos without a person's permission to make them famous - ANS-C- Social media, including blogs and Twitter, have helped spread information, both positive and negative. In a disaster situation, people often have their mobile device and may be able to signal for help and communicate with family members that they are safe.

What does it mean if a program runs in less time than another?

(A) It is efficient

(B) It is correct

(C) It has been verified

(D) It provides economies of scale in processing - ANS-A- One algorithm is considered to be more efficient than another if it runs in less time for the same data set. Efficiency may change as data sets get increasingly large. The more efficient algorithm will require less time and resources successfully complete.

How do parameters provide abstractions?

(A) They block invalid input values

(B) They return calculated values from the procedure to the calling program

(C) They allow software reuse for different values

(D) They provide the detail needed for an abstraction to function - ANS-C- Parameter use enables a procedure to be more general, and therefore more abstract, by providing a way to get different values to the block of code.

Tracing what your code is doing is an example of which one of the following terms?

(A) Discovery

(B) Debugging

(C) Shadowing the code

(D) Scaffolding - ANS-B- One method of debugging involves following or tracing each line of code to determine what the program is doing versus what it should be doing based on current variable values.

How can an organization begin the process of analyzing data?

(A) By following an iterative development process

(B) By establishing measurements the data should show

(C) By developing hypotheses and questions to test

(D) By checking to see if the data matches previously collected data - ANS-C- Developing hypotheses and questions and testing these with the data helps gain insight.

What is an example of "metadata"?

(A) A line of code

(B) A header in a document

(C) Author of the document

(D) Test data - ANS-C- Metadata means "data about data." The only option that provides information about data being data information about the author.

Why should we use an iterative development approach?

(A) Because each iteration improves or adds code to build a successful program

(B) To meet the legal requirements for code to handle sensitive data

(C) To be able to begin coding while remaining requirements are being defined

(D) To minimize the amount of time needed for testing - ANS-A- The steps are:

~ Investigate and fully define the problem to be solved

~ Plan to fully understand the scope of the problem

~ Design to identify a solution to solve the problem

What does it mean when we say the Internet is redundant?

(A) Parts of it are unnecessary

(B) If a path is down, packets can be routed a different way

(C) It has a delay between the request and the response to the request

(D) If there is an error, a backup system is brought online to be used - ANS-B- Internet redundancy means that if a path is down, then the packets can be sent via an alternate route to reach their destination.

What are packets when referring to the Internet?

(A) The delay in time from when a request is sent and received

(B) The individual sections of the IP address

(C) Information to be sent over the Internet broken into same size groupings

(D) The intermediate locations that send information to their destination - ANS-C- Packets are same size groupings of information to be sent over the Internet along different paths.

What type of software tools can organize and filter data?

(A) Word processing tools

(B) Spreadsheets and databases

(C) Interactive tools

(D) Input/output tools - ANS-B- Technology tools such as spreadsheets and databases are designed to organize data and easily set up inquiries and reports to analyze the data.

Which two measures are used to determine the efficiency of an algorithm?

(A) The time needed to compile and the size of the data set

(B) The time to run and the memory usage

(C) The number of lines of code and the size of the data set

(D) The number of procedures and the number of loops used - ANS-B- The efficiency of an algorithm measures the run time or memory requirements as the size of the data set increases. Algorithms with logarithmic efficiency are most efficient, followed by linear, and then quadratic efficiency.

What describes the process of keeping common or similar features and functionality while removing details that are different?

(A) An algorithm

(B) Decomposition

(C) Simulation

(D) Abstraction - ANS-D- Abstractions remove differing details to create a more general and more flexible concept.

Why is there a need for more than one programming language?

(A) Some programming languages are designed for specific uses and are best used in those situations

(B) Some programming languages cannot implement needed algorithms

(C) Some programming languages cannot be compiled and therefore cannot run efficiently

(D) There is no real need, just preferences of those who create new languages - ANS-A- Most programming languages can implement an algorithm, but some were designed for specific uses, such as for scientific calculations, and are best used in those situations.

What is the job of a computer's processor?

(A) To calibrate the hardware

(B) To determine how much memory is needed for a program task

(C) To maintain the connections of all the computer's components

(D) To hand the instructions when a program is being executed - ANS-D- The computer's processor, or CPU, handles all the instructions for programs that are actively running.

What is a benefit of combining algorithms>