Exercises: TSL
1. Modify the following code using comment and inserting missing symbols so that it would run properly
------ code start
Declaring a variable
static numCount This variable will hold the number of times I execut the test
// Assigning a value to this variable
numCount = 3;
/* Print the variable */
print("Value of numCount:" + numCount);
------ code ends
2) Indicate which of the following are incorrect And what (if anything is wrong)
int intNumberofDays
static numBankBalance
numBankBalance = "Hello";
public numLoopCounter
numLoopCounter = 14
Static strData;
static if = 0;
public +2;
+2 = "Hello";
Static list+names;
list+names = "John, James, Victor";
static a;
static b = "Hello";
a = b + "2";
3. Complete the following if statement to display "More than 10" if the input value is more than 10.
static numInput;
numInput = 7;
# Please create the appropriate if statement
4. Create an if statement to display "5 or more" if the input value is 5 or greater and "Less than 5" if it is not
static numInput;
numInput = 7;
# Please create the appropriate if statement
5) Create an if statement structure to display
* "Even" if a number is even
* "Odd" if the number is odd
* "Zero" if the number is 0
* "Negative" if the number is less than zero.
Please note that all these are mutually exclusive i.e. a number can either be even, odd, zero or negative.
6. Fix the errors in the following TSL code to make it function properly
Declare a variable
static numData
numData = 7; This is an assignment statement
//Print the value
print("numData");
7. Write TSL code that prints out all the even number between 1 and 10 in the following form
1, 3, 5, 7, 9
Note: PLease use only 1 pause statement.
<< Home