









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A comprehensive overview of computational thinking, algorithms, and programming fundamentals. It covers key concepts such as abstraction, algorithmic thinking, searching and sorting algorithms, and programming constructs like variables, constants, operators, and data types. The document also delves into defensive design considerations, testing techniques, and common errors in programming. It is a valuable resource for high school students learning about computer science.
Typology: Study notes
1 / 15
This page cannot be seen from the preview
Don't miss anything!










Flowchart symbols Arrows Arrows connect boxes and show the direction you should
follow. Some boxes might have multiple arrows coming in or going out of them. Rectangle General instructions, processes and calculations go in rectangular boxes Sub programs Parallelogra m Anything that’s put into or taken out of the algorithm goes in a parallelogram box Diamond Decisions, often a yes or no question are put in diamond boxes. The beginning and the end of the algorithm are put in boxes with rounded corners- they’re sometimes called terminals 2.1.3 Searching and Sorting Algorithms Standard Searching algorithms: Binary Search A binary search looks for items in an ordered list.
A linear search is much simpler than a binary search but not as efficient. A linear search can be used on any type of list, it doesn’t have to be ordered. Due to it being inefficient, a linear search is often only used on small lists. Once the list has been ordered, a binary search is much more efficient than a linear search. In general, a binary search takes fewer steps to find the item you’re looking for, which makes it more suitable for large lists of items. Standard Sorting Algorithms: Bubble Sort A bubble sort compares pairs of items. The bubble sort algorithm is used to sort an unordered list of items.
only have to do one pass of n-1 comparisons to check if the list is ordered or not.
The Common Arithmetic Operators
7 > 5 Greater than = 7 > = 7 Greater than or equals to The common Boolean operators AND, OR and NOT 2.2.2 Data Types Programming languages have Five Main Data Types Data Type Code Characteristics Examples Integer int A whole number, positive or negative. Only used for data that requires calculations.
Real (Float) real A number with a decimal part. Only used for data that requires calculations.
Boolean bool Can only take one of two values, usually TRUE or FALSE, often called a “FLAG”. Used to track if something has happened or not. True/False, Yes/NO, 1/ Character char A single letter, “A”, “k”, “5”, “-“
number, symbol String string Used to represent text, it is a collection of characters. Used for all data that is not calculated. “FsTmQ2”, “$money$” For example: Give the appropriate data type for each of the categories in this registration form. Initial of first name: N Surname: Chapman Age (in whole years): 27 Height (in metres): 1. Male of Female: Female Initial of first name should be stored as a character. Surname should be stored as a string. Age should be stored as an integer. Height should be stored as a real data type. Male of Female should be stored as Boolean. Changing a data type from one type to another is known as casting.
-Programs that read and write to files need to handle many types of exceptions, including: The File/folder not being found. The disk being out of space. The data in the file being corrupt. The end of the file being reached.