-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestions.txt
More file actions
115 lines (88 loc) · 3.65 KB
/
Questions.txt
File metadata and controls
115 lines (88 loc) · 3.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
Write these as static functions callable from Program.cs.
Print 1-255
public static void PrintNumbers()
{
// Print all of the integers from 1 to 255.
}
Print odd numbers between 1-255
public static void PrintOdds()
{
// Print all of the odd integers from 1 to 255.
}
Print Sum
public static void PrintSum()
{
// Print all of the numbers from 0 to 255,
// but this time, also print the sum as you go.
// For example, your output should be something like this:
// New number: 0 Sum: 0
// New number: 1 Sum: 1
// New Number: 2 Sum: 3
}
Iterating through an Array
public static void LoopArray(int[] numbers)
{
// Write a function that would iterate through each item of the given integer array and
// print each value to the console.
}
Find Max
public static int FindMax(int[] numbers)
{
// Write a function that takes an integer array and prints and returns the maximum value in the array.
// Your program should also work with a given array that has all negative numbers (e.g. [-3, -5, -7]),
// or even a mix of positive numbers, negative numbers and zero.
}
Get Average
public static void GetAverage(int[] numbers)
{
// Write a function that takes an integer array and prints the AVERAGE of the values in the array.
// For example, with an array [2, 10, 3], your program should write 5 to the console.
}
Array with Odd Numbers
public static int[] OddArray()
{
// Write a function that creates, and then returns, an array that contains all the odd numbers between 1 to 255.
// When the program is done, this array should have the values of [1, 3, 5, 7, ... 255].
}
Greater than Y
public static int GreaterThanY(int[] numbers, int y)
{
// Write a function that takes an integer array, and a integer "y" and returns the number of array values
// That are greater than the "y" value.
// For example, if array = [1, 3, 5, 7] and y = 3. Your function should return 2
// (since there are two values in the array that are greater than 3).
}
Square the Values
public static void SquareArrayValues(int[] numbers)
{
// Write a function that takes an integer array "numbers", and then multiplies each value by itself.
// For example, [1,5,10,-10] should become [1,25,100,100]
}
Eliminate Negative Numbers
public static void EliminateNegatives(int[] numbers)
{
// Given an integer array "numbers", say [1, 5, 10, -2], create a function that replaces any negative number with the value of 0.
// When the program is done, "numbers" should have no negative values, say [1, 5, 10, 0].
}
Min, Max, and Average
public static void MinMaxAverage(int[] numbers)
{
// Given an integer array, say [1, 5, 10, -2], create a function that prints the maximum number in the array,
// the minimum value in the array, and the average of the values in the array.
}
Shifting the values in an array
public static void ShiftValues(int[] numbers)
{
// Given an integer array, say [1, 5, 10, 7, -2],
// Write a function that shifts each number by one to the front and adds '0' to the end.
// For example, when the program is done, if the array [1, 5, 10, 7, -2] is passed to the function,
// it should become [5, 10, 7, -2, 0].
}
Number to String
public static object[] NumToString(int[] numbers)
{
// Write a function that takes an integer array and returns an object array
// that replaces any negative number with the string 'Dojo'.
// For example, if array "numbers" is initially [-1, -3, 2]
// your function should return an array with values ['Dojo', 'Dojo', 2].
}