C1/2 Introduction Flashcards
Includes chapter 1-2.7 (73 cards)
What is computational thinking?
Creating a sequence of instructions to solve a problem
What is an algorithm?
A sequence of instructions that solves a problem
What are the three main components of a computer program?
- Input
- Process
- Output
What does the input component of a computer program do?
Obtains data from sources (files, keyboard, touchscreen, network)
What does the process component of a computer program do?
Executes computations on the input data
What does the output component of a computer program do?
Displays or saves the processed data
What is a variable in programming?
Represents data; their values can change
Provide an example of how to assign a value to a variable in C++.
assign 2 to x
int x = 2;
What is the purpose of the preprocessor directive #include <iostream> in C++?</iostream>
Includes the standard input-output stream library
What does ‘using namespace std;’ allow in C++?
Use elements from the std (standard) namespace without prefixing
What does the statement ‘return 0;’ indicate in a C++ program?
The program ended successfully
How do you get input from the user in C++?
Using the statement cin»_space; variable;
What does the cout statement do?
Outputs data to the console
What is the difference between cout and cin?
cout outputs data, cin gets input data
What does the statement cout «_space;endl; do?
Outputs a newline character
What is a string literal?
Text in double quotes
What is a multi-line comment in C++?
Starts with /* and ends with */
What is a single-line comment in C++?
Starts with // and includes all following text on that line
Fill in the blank: A computer program can be analogized to a _______.
cooking recipe
What is the purpose of the statement ‘int main() {‘ in a C++ program?
Defines the main function where program execution begins
How do you declare an integer variable in C++?
Using the statement int variableName;
What is turtle graphics used for?
Instructing a robotic turtle to draw shapes using commands
What capability does the cout statement have regarding outputting multiple items?
The cout statement can output multiple items in one statement using the insertion operator («).
What does the statement ‘wage = 20;’ do in a C++ program?
Assigns the value 20 to the variable wage