Dev Tasks


Getting started
Before you can start tinkering, you need to get your tools up and running.

Task: Open Visual Studio.
Task: Create a .NET console project.
Task: Figure out how to run the program.

Console Projects
A console project is a program that executes within a console terminal. It can output text to the user and also receive text input from the user. This is the mose basic and arguably one of the most useful types of program. It is generally considered to be a non-UI (user interface) program, but the console can actually be thought of as a basic UI.

Task: Create a console project.
Task: Write the text "Hello World" to the console.

You can write to the console with Console.WriteLine();
Example:

Console.WriteLine("Hello World");



Variables
Variables are the heart and soul of programming, they allow you to store bits of data for later use. Without them we'd really have no programs at all.

Question: What is a variable?

A variable is a container for a value. It allows you to store information for later use.
Before you can use a variable, you must declare it. You can declare the variable using the following format:

[variableType] [variableName] = [variableValue];

When you declare a variable, you have to define its type. Variables can only contain the type of data that is specified at the time of their declaration.


Question: What are some basic varible types?

int //integer, use for whole numbers.
string //string is used to store text.
double //used to store decimal numbers, like 3.14
bool //used to store TRUE and FALSE.


Task: Declare a interger variable and set its value to 100.

Declare variables first by typing its type, then its name. Optionally followed by setting its value.

int value;
int value = 10;
int variableName = 100;


Task: Declare a string variable, set its value to "Hello" and write the variable to the console window.

Declare the variable:

string variableName = "Hello";

You can write to the console with Console.WriteLine();
Example:
string variableName = "Hello";
Console.WriteLine(variableName);


Task: Declare an integer variable, set it to 10, increment its value by 1 and then write the variable to the console window.

You can increment a variable in several ways (you can do the same with subtraction)

value = value + 1;  //Adds 1 to value;
		value++; //Adds 1 to value;
		value = value + 10; //Adds 10 to value;
		value += 10; //Adds 10 to value;

Example:
int value = 10;
value++;
Console.WriteLine(value);



Basic Flow Control
If variables are the heart and soul, then flow control functions are the gallbladder. Basic flow control functions allow your program to behaive differently based on input and variables. These functions include IF, SWITCH, WHILE, DO, and FOREACH.

Question: What is an IF statement?

An IF statement is the most common, widely used and most useful flow control statement in existence. Is tells the program to only do somehitng if a condition is true. This allows your program to act differently based on inputs.
Example:

if(userName = = "Aiden")
{
	Console.WriteLine("Hello Aiden");
}


Question: What is an ELSE statement?

An else statement is optional and is used in conjunction with an IF statement. It tells the program what to do if the IF statement is NOT true.
Example:

if(userName == "Aiden")
{
	Console.WriteLine("Hello Aiden!");
}
else (This is the ELSE statement.)
{
	Console.WriteLine("Hello Sombody else!");
}


Question: What is an ELSE-IF statement?

An ELSE-IF statement is optional and is used in conjunction with an IF statement. It tells the program what to do if the original IF statement is NOT true but the next statement IS true.
Example:

if(userName == "Aiden")
{
	Console.WriteLine("Hello Aiden!");
}
else if(userName = = "Cole") (This is the ELSE IF)
{
	Console.WriteLine("Hello Cole!");
}
else
{
	Console.WriteLine("Hello Sombody else!");
}


Task: Write a program that declares an interger with a value of 10 and outputs to the console "BIG" if the value is over 5, otherwise the program should output the text "SMALL"?

You will need to use an IF and an ELSE such as in the following example:

int value = 10;

if(value > 5)
{
	Console.WriteLine("BIG");
}
else
{
	Console.WriteLine("SMALL");
}



Functions
Functions allow you to neatly package up peices of code into a callable collection. They allow you to reuse important peices of code and also break down your code into manageable or logical chunks.

Question: What is a function?

A function is a collection of code that can be reused and called from various places in code.
For example, the function String.ToString() is a function that you will use alot. It contains all of the code to convert your variable to a string so you dont have to write all that code yourself each time.
A function typically takes parameters and returns a value and typically looks like this pseudo code:

[ReturnType] [FunctionName]([parameters])
{
	[code body....]
	return [return value];
}

Example:
int Times10(int value)
{
	return value * 10;
}


Task: Write a function that takes two parameters int x and int y. It should multiply them together and return the result.

Example:

int MyMultiply(int x, int y)
{
	return x * y;
}


Task: Using the function from above, write the return value to the console.

void main()
{
	Console.WiteLine(MyMultiply(5, 10));
}

int MyMultiply(int x, int y)
{
	return x * y;
}



Looping
A loop allows you to perform a task over-and-over again while a condition is true.

Question: What are the different types of loops?

while
for
do-while


Question: What is a loop flow-control statement?

You can control the flow of a loop with break; and continue;
Break tells the loop to exit now, even if the loop condition is still true.
Continue tells the program to go back to the top of the loop and start over without reaching the end of the loop.


Task: Declare an integer variable, set it to 0. In a while loop, increment your variable by 1 until it reaches 10. Each time you loop, write the result to the console.

While is like "if", it takes a condition and continues to loop over the scope defined by the curly brackets as long as that condition is true.
Example:

int value = 0;
while(value < 10)
{
	Console.WriteLine(value);
	value++; //This increments the value by one.
}


Task: Write a console program that allows the user to enter text in an infinite loop. Output the users text to the console.

For this task you will need to use a while loop, Console.ReadLine and Console.WriteLine.
Just like you can write text with Console.WriteLine(), you can get text from the user with the Console.ReadLine() function.
To make a loop infinite, you need to specify a condition that is always true. Such as 1 = = 1 or simply true.
Example:

while(true)
{
	userInput = Console.ReadLine();
	Console.WriteLine(userInput);
}


Task: In an infinite loop, write a console program that allows the user to enter text. Exit the loop when the user types "exit".

Again we will be using Console.ReadLine() but will also be using the flow control function BREAK to exit the loop.
Example:

while(true)
{
	string text = Console.ReadLine();
	if(text == "exit")
	{
		break;
	}
}


Task: Ask the user for their name and save it in a variable. In an infinite loop allow the user to input text, if they type "HI" then output their name.

Example:

Console.WriteLine("What is your name?");
string personName = Console.ReadLine();

while(true)
{
	string text = Console.ReadLine();
	if(text == "hi")
	{
		Console.WriteLine($"Hello {personName}!");
	}
}



Classes
Classes are what make up the bulk of the code in modern programming. Programming with classes is know as OOP or Object Oriented Programming. All of the functionality you write can be wrapped into classes and subcategories into smaller peices into sub-classes.
Writing code with classes is called encapsulation because the code is enclosed inside a class.

Question: What is a class?

A class is a collection of variables and functions that is "packaged up" and reusable. They also support things like inheritence, which we will get into later.
Classes generally have to be instantiated (which means to create an instance of). Just like you can declare a string called firstName and string called lastName, you can create multiple instances of your own classes too.


Question: Can you name any classes in the C# library?

string
int
double
Console
MessageBox


Question: What are class accessibility levels?

Class accessibility levels tell the class whether a function, property, or variable can be accessed from outside of the class or project.


Question: What are the major class accessibility levels?

public - The function or variable can be access by all code.
private - The function or variable can only be accessed by the class itself.
More advanced protection levels are (more on these later):
protected - The function or variable can only be accessed by the class itself and other classes derived from that class. More on that later.
internal - The function or variable is only accessible to the assembly (think: program),


Question: What is a class Function/Method?

Just like regular functions, a class function is a collection of C# code that can be reused, in this case that function would belong to a class.


Question: What is a class Property?

On the most basic level. a class property is like a variable that belongs to a class. Its value can be set and retreived. While it is not a function, you can write code that controls how the property is set and retreived.


Task: Create a class for a Automobile that can have a color and weight.

Example:

public class Automobile {
	public string Color;
	public int Weight;
}


Task: Using your Automobile class, declare an instance of the class and set the color to RED and the weight to 1000.

Before using a class we have to declare a variable of the class type (just like we would declare any other variable), but then we also have to instanciate it. This means we have to create an instance of the class and set it to our variable.
*Example:*

//Declare the variable:
Automobile mycar;

//Instanciate the variable
mycar = new Automobile();

//Set some class instance variables:
mycar.Color = "RED";
mycar.Weight = 1000;


Question: What is a static class?

Previously when we looked at classes we saw hoe we have to create an instance of a class in order to use it. This is not always the case. When we declare a class as static, we are staying that there is only one instance and it is already instanciated.


Task: Create a static class for a person that contains a FirsName and LastName.

Example:

static class Person {
	public string FirstName;
	public string LastName;
}


Task: Using the static Person class from above, set the value of FirstName to John and LastName to Smith and then write them to the console..

As you can see from the example below, we do not have to declare a variable for the Person class or instanciate it because its a STATIC class.
Example:

Person.FirstName = "John";
Person.LastName = "Smith";

Console.WriteLine($"{Person.FirstName} {Person.LastName}")'



Strings
String as probably the most used type of variable in C#. They are used to store text, or more accurately strings of characters - which is why they are called strings.

Task: Output the length of the string "Hello Cruel World".

A string is just a class, it has properties and one of those properties is the LENGTH property. This allows us yo easily figure out how long a string of text is.
someVariable.Length -or- "".Length
Example:

string text = "Hello Cruel World";
Console.WriteLine(text.Length);


Task: Using the string "Hello Cruel World", extract the middle word "Cruel" and output it to the console.

You can isolate parts of a string with the string class method SubString()
In this example you will see that the SubScring fnuction takes two parameters: a starting position and a length. We will pass 6 as the starting position which is the length of "HELLO ". Then we will pass 5 as the length which is the length of the word "Cruel". This will extract that part of the string and return it.
Example:

string text = "Hello Cruel World";
Console.WriteLine(text.SubString(6, 5));



Misc
A littany of misc miscellaneous console tasks now that you have gotten though the stuff above.

Task: Write a program to print Hello and your name in a separate line.

Expected Output :
Hello: Alexandra Abramov


Task: Write a program to print the sum of two numbers.
Task: Write a program to print the result of dividing two numbers.
Task: Write a program to print the result of the specified operations.

Test data:
-1 + 4 * 6
( 35+ 5 ) % 7
14 + -4 * 6 / 11
2 + 15 / 6 * 1 - 7 % 2
Expected Output:
23
5
12
3


Task: Write a program to swap two numbers.

Test data:
Input the First Number : 5
Input the Second Number : 6
Expected Output:
After Swapping :
First Number : 6
Second Number : 5



Task: Write a program to print the output of multiplication of three numbers which will be entered by the user.

Test data:
Input the first number to multiply: 2
Input the second number to multiply: 3
Input the third number to multiply: 6
Expected Output:
2 x 3 x 6 = 36


Task: Write a program to print on screen the output of adding, subtracting, multiplying and dividing of two numbers which will be entered by the user.

Test data:
Input the first number: 25
Input the second number: 4
Expected Output:
25 + 4 = 29
25 - 4 = 21
25 x 4 = 100
25 / 4 = 6
25 mod 4 = 1


Task: Write a program that takes a number as input and print its multiplication table.

Test data:
Enter the number: 5
Expected Output:
5 * 0 = 0
5 * 1 = 5
5 * 2 = 10
5 * 3 = 15
....
5 * 10 = 50


Task: Write a program that takes four numbers as input to calculate and print the average.

Test data:
Enter the First number: 10
Enter the Second number: 15
Enter the third number: 20
Enter the four number: 30
Expected Output:
The average of 10 , 15 , 20 , 30 is: 18



Task: Write a program to that takes three numbers(x,y,z) as input and print the output of (x+y)*z and x*y + y*z.

Test data:
Enter first number - 5
Enter second number - 6
Enter third number - 7
Expected Output:
Result of specified numbers 5, 6 and 7, (x+y).z is 77 and x*y + y*z is 72


Task: Write a program that takes an age (for example 20) as input and prints something as "You look older than 20".

Test data:
Enter your age - 25
Expected Output:
You look older than 25


Task: Write a program to that takes a number as input and display it four times in a row (separated by blank spaces), and then four times in the next row, with no separation. You should do it two times: Use Console. Write and then use {0}.

Test data:
Enter a digit: 25
Expected Output:
25 25 25 25
25252525
25 25 25 25
25252525


Task: Write a program that takes a number as input and then displays a rectangle of 3 columns wide and 5 rows tall using that digit.

Test data:
Enter a number: 5
Expected Output:
555
5 5
5 5
5 5
555


Task: Write a program to convert from celsius degrees to Kelvin and Fahrenheit.

Test data:
Enter the amount of celsius: 30
Expected Output:
Kelvin = 303
Fahrenheit = 86


Task: Write a program to remove specified a character from a non-empty string using index of a character.

Test data:
w3resource
Sample Output:
wresource
w3resourc
3resource


Task: Write a program to create a new string from a given string where the first and last characters will change their positions.

Test data:
w3resource
Python
Sample Output:
e3resourcw
nythoP
x


Task: Write a program to create a new string from a given string (length 1 or more ) with the first character added at the front and back.

Sample Output:
Input a string : The quick brown fox jumps over the lazy dog.
TThe quick brown fox jumps over the lazy dog.T


Task: Write a program to check two given integers and return true if one is negative and one is positive.

Sample Output:
Input first integer:
-5
Input second integer:
25
Check if one is negative and one is positive:
True


Task: Write a program to compute the sum of two given integers, if two values are equal then return the triple of their sum.
Task: Write a program to get the absolute value of the difference between two given numbers. Return double the absolute value of the difference if the first number is greater than second number.
Task: Write a program to check the sum of the two given integers and return true if one of the integer is 20 or if their sum is 20.
Task: Write a program to check if an given integer is within 20 of 100 or 200.

Sample Output:
Input an integer:
25
False


Task: Write a program to convert a given string into lowercase.

Sample Output:
write a program to display the following pattern using the alphabet.


Task: Write a program to find the longest word in a string.

Test data: Write a program to display the following pattern using the alphabet.
Sample Output:
following


Task: Write a program to print the odd numbers from 1 to 99. Prints one number per line.

Sample Output:
Odd numbers from 1 to 99. Prints one number per line.
1
3
5
7
9
...
95
97
99


Task: Write a program and compute the sum of the digits of an integer.

Sample Output:
Input a number(integer): 12
Sum of the digits of the said integer: 3


Task: Write a program to reverse the words of a sentence.

Sample Output:
Original String: Display the pattern like pyramid using the alphabet.
Reverse String: alphabet. the using pyramid like pattern the Display


Task: Write a program to find the size of a specified file in bytes.

Sample Output:
Size of a file: 31


Task: Write a program to convert a hexadecimal number to decimal number.

Sample Output:
Hexadecimal number: 4B0
Convert to-
Decimal number: 1200


Task: Write a program to multiply corresponding elements of two arrays of integers.

Sample Output:
Array1: [1, 3, -5, 4]
Array2: [1, 4, -5, -2]
Multiply corresponding elements of two arrays:
1 12 25 -8


Task: Write a program to create a new string of four copies, taking last four characters from a given string. If the length of the given string is less than 4 return the original one.

Sample Output:
Input a string : The quick brown fox jumps over the lazy dog.
dog.dog.dog.dog.


Task: Write a program to check if a given positive number is a multiple of 3 or a multiple of 7.

Sample Output:
Input first integer:
15
True


Task: Write a program to check if a string starts with a specified word.

Note: Suppose the sentence starts with "Hello"
Sample Data: string1 = "Hello how are you?"
Result: Hello.
Sample Output:
Input a string : Hello how are you?
True


Task: Write a program to check two given numbers where one is less than 100 and other is greater than 200.

Sample Output:
Input a first number(<100): 75
Input a second number(>100): 250
True


Task: Write a program to check if an integer (from the two given integers) is in the range -10 to 10.

Sample Output:
Input a first number: -5
Input a second number: 8
True


Task: Write a program to check if "HP" appears at second position in a string and returns the string without "HP".

Test data: PHP Tutorial
Sample Output:
P Tutorial


Task: Write a program to get a new string of two characters from a given string. The first and second character of the given string must be "P" and "H", so PHP will be "PH".

Test data: PHP
Sample Output:
PH


Task: Write a program to find the largest and lowest values from three integer values.

Test data:
Input first integer:
15
Input second integer:
25
Input third integer:
30
Sample Output
Largest of three: 30
Lowest of three: 15


Task: Write a program to check the nearest value of 20 of two given integers and return 0 if two numbers are same.

Test data:
Input first integer:
15
Input second integer:
12
Sample Output
15


Task: Write a program to check if a given string contains ‘w’ character between 1 and 3 times.

Test data:
Input a string (contains at least one 'w' char) : w3resource
Test the string contains 'w' character between 1 and 3 times:
Sample Output
True


Task: Write a program to create a new string where the first 4 characters will be in lower case. If the string is less than 4 characters then make the whole string in upper case.

Test data:
Input a string: w3r
Sample Output
W3R


Task: Write a program to check if a given string starts with "w" and immediately followed by two "ww".

Test data:
Input a string : www
Sample Output
False


Task: Write a program to create a new string of every other character (odd position) from the first position of a given string.

Test data:
Input a string : w3resource
Sample Output
wrsuc


Task: Write a program to count a specified number in a given array of integers.

Test data:
Input an integer: 5
Sample Output
Number of 5 present in the said array: 2


Task: Write a program to check if a number appears as either the first or last element of an array of integers and the length is 1 or more.

Test data:
Input an integer: 25
Sample Output
False


Task: Write a program to compute the sum of all the elements of an array of integers.

Test data:
Array1: [1, 2, 2, 3, 3, 4, 5, 6, 5, 7, 7, 7, 8, 8, 1]
Sample Output
Sum: 69


Task: Write a program to check if the first element and the last element are equal of an array of integers and the length is 1 or more.

Test data:
Array1: [1, 2, 2, 3, 3, 4, 5, 6, 5, 7, 7, 7, 8, 8, 1]
Sample Output
True


Task: Write a program to check if the first element or the last element of the two arrays ( length 1 or more) are equal.

Test data:
Array1: [1, 2, 2, 3, 3, 4, 5, 6, 5, 7, 7, 7, 8, 8, 1]
Array2: [1, 2, 2, 3, 3, 4, 5, 6, 5, 7, 7, 7, 8, 8, 5]
Check if the first element or the last element of the two arrays ( leng th 1 or more) are equal.
Sample Output
True


Task: Write a program to rotate an array (length 3) of integers in left direction.

Test data:
Array1: [1, 2, 8]
After rotating array becomes: [2, 8, 1]


Task: Write a program to get the larger value between first and last element of an array (length 3) of integers.

Test data:
Array1: [1, 2, 5, 7, 8]
Highest value between first and last values of the said array: 8


Task: Write a program to create a new array of length containing the middle elements of three arrays (each length 3) of integers.

Test data:
Array1: [1, 2, 5]
Array2: [0, 3, 8]
Array3: [-1, 0, 2]
New array: [2, 3, 0]


Task: Write a program to check if an array contains an odd number.

Test data:
Original array: [2, 4, 7, 8, 6]
Check if an array contains an odd number? True


Task: Write a program to get the century from a year.
Task: Write a program which will accept a list of integers and checks how many integers are needed to complete the range.

Sample Example [1, 3, 4, 7, 9], between 1-9 -> 2, 5, 6, 8 are not present in the list. So output will be 4.


Task: Write a program to calculate the sum of all the integers of a rectangular matrix except those integers which are located below an intger of value 0.

Sample Example:
matrix = [[0, 2, 3, 2],
[0, 6, 0, 1],
[4, 0, 3, 0]]
Eligible integers which will be participated to calculate the sum -
matrix = [[X, 2, 3, 2],
[X, 6, X, 1],
[X, X, X, X]]
Therefore sum will be: 2 + 3 + 2 + 6 + 1 = 14


Task: Write a program to sort the integers in ascending order without moving the number -5.
Task: Write a program to reverse the strings contained in each pair of matching parentheses in a given string and also remove the parentheses within the given string.
Task: Write a program to check if a given number present in an array of numbers.
Task: Write a program to get the file name (including extension) from a given path.
Task: Write a program to multiply all of elements of a given array of numbers by the array length.
Task: Write a program to find the minimum value from two given two numbers, represented as string.
Task: Write a program to create a coded string from a given string, using specified formula.

Replace all 'P' with '9', 'T' with '0', 'S' with '1', 'H' with '6' and 'A' with '8'.
Sample Output:
969
J8V81CRI90


Task: Write a program to count a specified character (both cases) in a given string.
Task: Write a program to check if a given string contains only lowercase or uppercase characters.
Task: Write a program to remove the first and last elements from a given string.

Sample Output:
Original string: PHP
After removing first and last elements: H
Original string: Python
After removing first and last elements: ytho
Original string: JavaScript
After removing first and last elements: avaScrip


Task: Write a program to check if a given string contains two similar consecutive letters.

Sample Output:
Original string: PHP
Test for consecutive similar letters! False
Original string: PHHP
Test for consecutive similar letters! True
Original string: PHPP
Test for consecutive similar letters! True
Original string: PPHP
Test for consecutive similar letters! True


Task: Write a program to check whether the average value of the elements of a given array of numbers is a whole number or not.

Sample Output:
nums = { 1, 2, 3, 5, 4, 2, 3, 4 }
Check the average value of the said array is a whole number or not: True
nums1 = { 2, 4, 2, 6, 4, 8 }
Check the average value of the said array is a whole number or not: False


Task: Write a program to convert the letters of a given string (same case-upper/lower) into alphabetical order.

Sample Output:
Original string: PHP
Convert the letters of the said string into alphabetical order: HPP
Original string: javascript
Convert the letters of the said string into alphabetical order: aacijprstv
Original string: python
Convert the letters of the said string into alphabetical order: hnopty


Task: Write a program to check the length of a given string is odd or even. Return 'Odd length' if the string length is odd otherwise 'Even length'.

Sample Output:
Original string: PHP
Convert the letters of the said string into alphabetical order: Odd length
Original string: javascript
Convert the letters of the said string into alphabetical order: Even length
Original string: python
Convert the letters of the said string into alphabetical order: Even length


Task: Write a program which takes a positive number and return the nth odd number.

Sample Output:
1st odd number: 1
2nd odd number: 3
4th odd number: 7
100th odd number: 199


Task: Write a program to get the ASCII value of a given character.

Sample Output:
Ascii value of 1 is: 49
Ascii value of A is: 65
Ascii value of a is: 97
Ascii value of # is: 35


Task: Write a program to check whether a given word is plural or not.

Sample Output:
Is 'Exercise' is plural? False
Is 'Exercises' is plural? True
Is 'Books' is plural? True
Is 'Book' is plural? False


Task: Write a program to find sum of squares of elements of a given array of integers.

Sample Output:
Sum of squares of elements of the said array: 14
Sum of squares of elements of the said array: 29


Task: Write a program to convert an integer to string and a string to an integer.

Sample Output:
Original value and type: 50, System.String
Convert string to integer:
Return value and type: 50, System.Int32
Original value and type: 122, System.Int32
Convert integer to string:
Return value and type: 122, System.String


Task: Write a program to convert all the values of a given array of mixed values to string values.

Sample Output:
Printing original array elements and their types:
Value-> 25 :: Type-> System.Int32
Value-> Anna :: Type-> System.String
Value-> False :: Type-> System.Boolean
Value-> 4/15/2021 10:37:47 AM :: Type-> System.DateTime
Value-> 112.22 :: Type-> System.Double
Printing array elements and their types:
Value-> 25 :: Type-> System.String
Value-> Anna :: Type-> System.String
Value-> False :: Type-> System.String
Value-> 4/15/2021 10:37:47 AM :: Type-> System.String
Value-> 112.22 :: Type-> System.String


Task: Write a program to swap a two digit given number and check whether the given number is greater than its swap value.

Sample Output:
Input an integer value:
Check whether the said value is greater than its swap value: True


Task: Write a program to remove all characters which are non-letters from a given string.

From Wikipedia,
A letter is a segmental symbol of a phonemic writing system. The inventory of all letters forms the alphabet. Letters broadly correspond to phonemes in the spoken form of the language, although there is rarely a consistent, exact correspondence between letters and phonemes
Sample Output:
Orginal string: Py@th12on
Remove all characters from the said string which are non-letters: Python
Orginal string: Python 3.0
Remove all characters from the said string which are non-letters: Python
Orginal string: 2^sdfds*^*^jlljdslfnoswje34u230sdfds984
Remove all characters from the said string which are non-letters: sdfdsjlljdslfnoswjeusdfds


Task: Write a program to remove all vowels from a given string.

Sample Output:
Orginal string: Python
After removing all the vowels from the said string: Pythn
Orginal string: C Sharp
After removing all the vowels from the said string: C Shrp
Orginal string: JavaScript
After removing all the vowels from the said string: JvScrpt


Task: Write a program to get the index number of all lower case letters in a given string.

Sample Output:
Orginal string: Python
Indices of all lower case letters of the said string:
1 2 3 4 5
Orginal string: JavaScript
Indices of all lower case letters of the said string:
1 2 3 5 6 7 8 9


Task: Write a program to find the cumulative sum of an array of number.

A cumulative sum is a sequence of partial sums of a given sequence. For example, the cumulative sums of the sequence {x, y, z,...}, are x , x+y , x+y+z
Sample Output:
Orginal Array elements:
1 3 4 5 6 7
Cumulative sum of the said array elements:
1 4 8 13 19 26
Orginal Array elements:
1.2 -3 4.1 6 -5.47
Cumulative sum of the said array elements:
1.2 -1.8 2.3 8.3 2.83


Task: Write a program to get the number of letters and digits in a given string.

Sample Output:
Original string:: Python 3.0
Number of letters: 6 Number of digits: 2
Original string:: dsfkaso230samdm2423sa
Number of letters: 14 Number of digits: 7


Task: Write a program to reverse a boolean value.

Sample Output:
Original value: False
Reverse value: True
Original value: True
Reverse value: False


Task: Write a program to find the sum of the interior angles (in degrees) of a given Polygon. Input number of straight line(s).

From Wikipedia,
In geometry, a polygon is a plane figure that is described by a finite number of straight line segments connected to form a closed polygonal chain or polygonal circuit. The solid plane region, the bounding circuit, or the two together, may be called a Polygon.
Sample Output:
Input number of straight lines of the polygon:
Sum of the interior angles (in degrees) of the said polygon: -360


Task: Write a program to count positive and negative numbers in a given array of integers.

Sample Output:
Original Array elements:
10 -11 12 -13 14 -18 19 -20
Number of positive numbers: 4
Number of negative numbers: 4
Original Array elements:
-4 -3 -2 0 3 5 6 2 6
Number of positive numbers: 5
Number of negative numbers: 3
Original Array elements:
Number of positive numbers: 0
Number of negative numbers: 0


Task: Write a program to count number of ones and zeros in the binary representation of a given integer.

Sample Output:
Original number: 12
Number of ones and zeros in the binary representation of the said number:
Number of ones: 2
Number of zeros: 2
Original number: 1234
Number of ones and zeros in the binary representation of the said number:
Number of ones: 5
Number of zeros: 6


Task: Write a program to remove all the values except integer values from a given array of mixed values.

Sample Output:
Original array elements:
25 Anna False 4/24/2021 11:43:11 AM -112 -34.67
After removing all the values except integer values from the said array of mixed values: 25 -112


Task: Write a program to calculate the square root of a given number. Do not use any built-in-function, return integer part of the result.

Sample Data:
(120) -> 10
(225) -> 15
(335) -> 18


Task: Write a program that finds the longest common prefix from an array of strings.

Sample Data:
({ "Padas", "Packed", "Pace", "Pacha" }) -> "Pa"
({ "Jacket", "Joint", "Junky", "Jet" }) -> "J"
({ "Bort", "Whang", "Yarder", "Zoonic" }) -> ""


Task: Write a programme to check the said string is valid or not. The input string will be valid when open brackets and closed brackets are same type of brackets.

Or
open brackets will be closed in proper order.
Sample Data:
( "<>") -> True
("<>()[]{}”) -> True
("(<>”) -> False
("[<>()[]{}]”) -> True


Task: Write a program to check whether all the characters in a string are the same. Return true if all the characters in the said string are same otherwise false.

Sample Data:
("aaa") -> True
("abcd") -> False
("3333") -> True
("2342342") -> False


Task: Write a program to check if a given string (floating point and negative numbers included) is numeric or not. Return True if the said string is numeric otherwise false.

Sample Data:
("123") -> True
("123.33") -> True
("33/33") -> False
("234234d2") -> False


Task: Write a program to check the equality comparison (value and type ) of two parameters. Return true if they are equal otherwise false.

Sample Data:
("AAA", "BBB") -> False
(true, false) -> False
(true, "true") -> False
(10, 10) -> True


Task: Write a program to create a identity matrix.

Sample Data:
Input a number: 3
1 0 0
0 1 0
0 0 1


Task: Write a program to sort characters in a given string (uppercase/lowercase letters and numbers). Return the new sorted string.

Sample Data:
("AAAbfed231") -> "AAAbdef123"
(" ") -> "Blank string!"
("Python") -> "hnoPty"
("W3resource") -> "ceeorrsuW3"


Task: Write a program to compare equality of three integers and calculate how many integers have the same value.

Sample Data:
(1,2, 3) -> 0
(1,3,3) -> 2
(3,3,3) -> 3


In the works
Items below here are still being written, ignore them for now.

Winforms Projects
Basic
Task: Make a program that displays a message box that says "HELLO!" when you press a button.
Task: Make a program that adds two numbers and displays the result in a message box when you press a button.

Events
Task: Create a program that has a button, but add the click event manually.

You can see the events exposed to a class (yes, button is a class) by hitting dot (.) after the class instance name.
buttonOk.Clicked +=
In visual studio, the program will auto complete the various components to "wire up" the event when you hit tab.



Other


Last modified by admin @ 12/11/2023 12:25:03 PM