Computer Science and Programming Fundamentals

Ace your homework & exams now with Quizwiz!

Types of Loops

A for loop is a loop that runs for a preset number of times. A while loop is a loop that is repeated as long as an expression is true. An expression is a statement that has a value. A do while loop or repeat until loop repeats until an expression becomes false. An infinite or endless loop is a loop that repeats indefinitely because it has no terminating condition, the exit condition is never met or the loop is instructed to start over from the beginning. Although it is possible for a programmer to intentionally use an infinite loop, they are often mistakes made by new programmers. A nested loop appears inside any other for, while or do while loop.

Functions

A function is a block of organized, reusable code that is used to perform a single, related action. Functions provide better modularity for your application and a high degree of code reusing. You have already seen various functions like printf() and main(). These are called built-in functions provided by the language itself, but we can write our own functions as well

Low level programming language

A low-level language is a programming language that deals with a computer's hardware components and also constraints. It has no (or only a minute level of) abstraction in reference to a computer and works to manage a computer's operational semantics. Low-level language may also be referred to as a computer's native language. Machine language and assembly language are popular examples of low-level languages. A low-level language is a programming language that provides little or no abstraction of programming concepts. And is likewise very close to writing actual machine instructions. Two good examples of low-level languages are assembly and machine code.

High level programming language

A programming language that enables a programmer to write programs that are more or less independent of a particular type of computer. Such languages are considered high-level because they are closer to human languages and further from machine languages. Examples: JavaScript, Java, FORTRAN

Variables

A variable is a way of referring to a storage area in a computer program. This memory location holds values—numbers, text or more complicated types of data like payroll records. Variables are used to store information to be referenced and manipulated in a computer program. They also provide a way of labeling data with a descriptive name, so our programs can be understood more clearly by the reader and ourselves. It is helpful to think of variables as containers that hold information. Their sole purpose is to label and store data in memory. This data can then be used throughout your program.

Algorithm

An algorithm is a set of instructions, sometimes called a procedure or a function, that is used to perform a certain task or solve a particular problem. This can be a simple process, such as adding two numbers together, or a complex function, such as adding effects to an image.

Expressions

An expression is a particular concept in computer science in which a number of variables or constants, and operators and functions, are put together in a single statement that is acted on by a particular programming language.

Compilers

Compilers convert high level programming languages like Java or C++ into binary code that computers can understand. If the syntax is incorrect, the code will not compile.

Conditional

In computer science, conditional statements, conditional expressions and conditional constructs are features of a programming language, which perform different computations or actions depending on whether a programmer-specified boolean condition evaluates to true or false.

Interpreters

Interpreters execute programming languages such as JavaScript or Python at runtime. The incorrect syntax will cause the code to fail.

Basic Structure of Computer Programming

Loop, selection, and sequence are the three basic structures of computer programming. These three logic structures are used in combination to form algorithms for solving any logic problem. This process is called structured programming.

Machine language or binary code

Machine language, or machine code, is a low-level language comprised of binary digits (ones and zeros). High-level languages, such as Swift and C++ must be compiled into machine language before the code is run on a computer. Since computers are digital devices, they only recognize binary data. Every program, video, image, and character of text is represented in binary. This binary data, or machine code, is processed as input by the CPU. The resulting output is sent to the operating system or an application, which displays the data visually. For example, the ASCII value for the letter "A" is 01000001 in machine code, but this data is displayed as "A" on the screen.

Computer programming syntax

Syntax refers to the rules that define the structure of a language. Syntax in computer programming means the rules that control the structure of the symbols, punctuation, and words of a programming language. If the syntax of a language is not followed, the code will not be understood by a compiler or interpreter.

Loops

The computational concept of running the same sequence multiple times. A loop in a computer program is an instruction that repeats until a specified condition is reached. A computer programmer who needs to use the same lines of code many times in a program can use a loop to save time. Just about every programming language includes the concept of a loop.


Related study sets

Chapter 31: Obstructive Pulmonary Diseases

View Set

Chapter 11: Organizational Theory

View Set

Database Systems Ch1 Review Questions

View Set

Elimination and Fluid/Electrolyte

View Set

Economics 4.6 - Market Structures: Perfect Competition

View Set

Chapter 36: Management of Patients With Immune Deficiency Disorders

View Set

Exam #4 Chapter 9:Stereotyping & Prejudice (2)

View Set

The Rise and Fall of the Populist Party (1892-1909)

View Set

MetEd: Tropical Cyclone Forecast Uncertainty

View Set

GBA 2, Assignment 10 Social Insurance Concept

View Set

GEOG 161: Exam 3 (Chapters 8, 9, 10, 11)

View Set