What does this code do?
Data types/arithmetic operators
Syntax/habits
Indexing
What is wrong with the code
100

cout<<"This is the last coding club meeting"<<endl;

This is the last coding club meeting

100

"dolphin"

String 

100

What do you put at the end of each line?

semicolon (;)

100

string my_string = "Hello World";

my_string[0]

H

100

cout<<"What is your favorite food?;

The second quotation mark is missing 

200

string seasons = "winter";

string season = "summer"

cout<<"My favorite season is "<<seasons << " and my least favorite season is << season;

My favorite season is winter and my least favorite season is summer

200

What data type does this list consist?

["c","r","q","z",k"]

Char

200

What do you include at the top of each coding lab you do?

using namespace std;

200

list<str> my_list = ("sleep ", "turtle ", "love ", "hate ", "apple ", "butterfly ");

cout<<my_list[5]<<my_list[2]<<mylist[0];

butterflylovesleep

200

string hello = "hello";

Cout<<hello< " world"<<endl;

hello world 
300

int num1 = 9

int num2 = 5

if(num1<num2){

cout<<"Are you sure you are correct?";

}

else{

cout<<"Check your work again.";

}

Check your work again.

300

What is the difference between a float and an integer?

integer is without a decimal point and float is a number with a decimal point

300

What is important to remember about writing functions?

It is important to include it at the top of your code so that it is defined before you use it. 

300

list <str> alphabet = ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z");

cout<<alphabet[7]<<alphabet[4]<<alphabet[11]<<alphabet[18];

hels

300

number. = 12; 

 cout << "My favorite number is."<<number;

No variable type is states which in this case is an int 

400

for(int i=4; i<=20; i+=3){

cout<<"pizza is good"<<endl;

i++;

}

pizza is good

pizza is good

pizza is good

pizza is good

pizza is good

400

What is modulo?

Modulo is the remainder when you divide something.

400

What data type is main, and what do you use it for?

The data type is a function, and it is where you write all of your code besides other functions. 

400

string word = "Is this a question?"

How would I slice the string word to get the output "this a"?

word.substr(3,6)

400

int num=9

int NNM=12;

if(num>NNM){

cout<<"The numbers added together is "<<NNMnum endl;

};

esle{

cout<<"The numbers subtracted is "<<num-NNM;

}; 

1. No semicolon after 9

2. Missing the addition sign in the first if statement

3. Semicolon after both the brackets in the if and the else

4. else is spelled wrong 

500

NOTE: Numbers entered are 24 & 30 respectively


int function(int num, int numm);


int main()

{

    

    int numm, num;

    cout<<"Enter first number: ";

    cin>>num;

    

    cout<<endl<<"Enter second number: ";

    cin>>numm;

    

    int maths = function(numm, num);

    cout<<endl<<maths;

    

}


int function(int num, int numm){

    int math = num - numm; 

    return math;

}


6

500

When would integer division apply, and when would float division happen?

Integer divison would happen if both the numbers are integers, and float division would happen is one number is a float. 

500

What are the different return types for functions and what do they do? 

string: returns a string

int: returns an integer

float: returns a float

char: returns a char

void: returns nothing 

500

What would be printed out (kind of less of an indexing question lol) 

indexer("Coding club 2024")

void indexer(str word){ 

for (int i = 1; i<word.size(); i+=2)

{

 cout<<word[i]; 

}

oigcu 04

500

int main

{

    int numm, num;

    cout<<"Enter first number: ";

    cin>>num;

   

    cout<<end<<"Enter second number: ";

    cin>>Numm;

    

    int maths = function(numm, num);

    cout<<endl<<maths;

}  

int function( num,  numm){

    int math = num  numm; 

    return math;

}


1. Does not call function before the main function

2. Missing the paranthesis after 'main'

3. endl is spelled wrong

4. The variable 'numm' is spelled wrong

5. int is missing in the paranthesis of function

6. A math sign is missing