Assignment - Week 2.

This week, 6 tasks, Using Operators, Concatenation, Variables & Concatenation, Increment & Decrement, Built-in Objects and revision Q&A.

Task1, Using Operators:

Script for add, subtract, multiply & divide

Task2, Concatenation. Concatenation
Task3, Concatenation & Variables. Variables & Concatenation
Task4, Increment & Decrement Increment & Decrement
Task5, Built-in Objects Built-in Objects

Task6, Q & A:

Q1. What are programming elements?

  • Programming elements are the pieces of a program. They could be a definition of a variable to a complete subroutine. They are the building blocks of your program.

Q2. What is the difference between an expression and a statement?

  • A statement causes an action to take place, whereas an expression may create a value that a statment could use to take an action upon.

Q3. Please tell me, in your own words, what a statement does.

  • Statements are the native commands of a programming language. They are what you use to make your program interact with the user, or outside world, in the way you want it to; hopefully! Statements may take the form of looping branching, or conditional branching to a different part of the program as a result of a user input, or simply be the definition of a variable, eg.

    var helloWorld //where var is the statement and the variable defined (helloWorld) is the action.

Q4. Give an example of a complete statement using only operators, variables and values (an expression statement).

  • helloWorld=2+3 /*Variable is helloWorld, = is an operator, 2 and 3 are both values and + is also an operator*/
Back