Questions and Answers
What is looping?
refers to the repeated execution of a statement.
What is a While Loop?
a structure that allows actions to be repeated while a condition is true.
What is a DoWhile Loop?
a structure that tests the condition at the end of the body of the loop.
What is a For Loop?
Signup and view all the answers
What does the Math Class do?
Signup and view all the answers
How are Math Methods called?
Signup and view all the answers
What is the syntax of a Math Method?
Signup and view all the answers
All math methods return data type double.
Signup and view all the answers
The Math class must be invoked using Math and the dot operator.
Signup and view all the answers
What does E() return?
Signup and view all the answers
What does PI() return?
Signup and view all the answers
What does Abs() return?
Signup and view all the answers
What does Ceiling(double) return?
Signup and view all the answers
What does Cos(double) return?
Signup and view all the answers
What does Exp(double) return?
Signup and view all the answers
What does Floor(double) return?
Signup and view all the answers
What does Log(double) return?
Signup and view all the answers
What does Max(int,int) return?
Signup and view all the answers
What does Min(int,int) return?
Signup and view all the answers
What does Pow(int) return?
Signup and view all the answers
What does Round(double) return?
Signup and view all the answers
What does Sign(int) return?
Signup and view all the answers
What does Sin(double) return?
Signup and view all the answers
What does Sqrt(double) return?
Signup and view all the answers
What does Tan(double) return?
Signup and view all the answers
What does Truncate(double) return?
Signup and view all the answers
What does Acos() return?
Signup and view all the answers
What does Asin() return?
Signup and view all the answers
What does Atan() return?
Signup and view all the answers
What does DivRem() do?
Signup and view all the answers
What is an Array used for?
Signup and view all the answers
What does an Array store?
Signup and view all the answers
A specific element in an array is easily accessed by ____.
Signup and view all the answers
What is a One Dimensional Array?
Signup and view all the answers
What does the length/size of an Array represent?
Signup and view all the answers
What are the two steps to create an Array?
Signup and view all the answers
To declare an Array, what must you specify?
Signup and view all the answers
What is the declaring syntax for an Array?
Signup and view all the answers
What does [] specify in an Array?
Signup and view all the answers
What is the initializing syntax for an Array?
Signup and view all the answers
What does the keyword 'new' do in Array handling?
Signup and view all the answers
What are the two steps to use an Array?
Signup and view all the answers
How is an Element accessed in an Array?
Signup and view all the answers
What is a Selection Structure?
Signup and view all the answers
What can a Boolean data type hold?
Signup and view all the answers
What are Relational Operators intended for?
Signup and view all the answers
What are Logical Operators used for?
Signup and view all the answers
What is an IF selection structure?
Signup and view all the answers
What is an IF/ELSE selection structure?
Signup and view all the answers
What is IF/ELSE IF/ELSE known for?
Signup and view all the answers
What are Curly Braces {} used for?
Signup and view all the answers
What are Code Blocks used for in C#?
Signup and view all the answers
Study Notes
Looping Concepts
- Looping executes a sequence of statements repeatedly.
- While Loop continues execution as long as a specified condition remains true.
- DoWhile Loop resembles a While Loop but checks its condition after the loop body executions.
- For Loop performs a series of statements repeatedly, managing the loop variable within a compact structure.
Math Class Overview
- Contains various methods for performing mathematical calculations efficiently.
- Methods are accessed using "Math" followed by a dot and the method name (e.g., Math.MethodName(arguments)).
- All Math methods return a data type of double, ensuring precise mathematical results.
Key Math Methods
- E() returns the base of natural logarithms as a double.
- PI() provides the value of π (pi) as a double.
- Abs() calculates the absolute value of a number.
- Ceiling(double) identifies the smallest integer greater than the specified value.
- Cos(double) computes the cosine of an angle in radians.
- Exp(double) evaluates e raised to a specified power.
- Floor(double) finds the largest integer less than the specified value.
- Log(double) gives the natural logarithm of the specified value.
- Max(int, int) returns the higher of two given values.
- Min(int, int) returns the lower of two specified values.
- Pow(int, int) computes a number raised to a specified power.
- Round(double) rounds a number to the nearest integer.
- Sign(int) returns the sign of a given value.
- Sin(double) finds the sine of an angle in radians.
- Sqrt(double) returns the square root of a value.
- Tan(double) determines the tangent of an angle in radians.
- Truncate(double) discards fractional digits and returns the integer portion.
- Acos() calculates the angle whose cosine equals a specified value.
- Asin() computes the angle corresponding to a specified sine value.
- Atan() provides the angle corresponding to a specified tangent value.
- DivRem() calculates both the quotient and the remainder of two numbers.
Arrays in C#
- Arrays store collections of data with a fixed size, requiring elements to be of the same data type.
- Elements are accessed through specific indices in the array.
- One Dimensional Arrays provide the simplest storage format, listing elements in order.
- Array length indicates how many values can be stored.
Array Declaration and Initialization
- To declare an array, specify the data type and the name.
- Declaring syntax is structured as:
datatype[] arrayName;
. - The indication or rank of an array is represented using square brackets [].
- Initialization syntax for arrays follows:
datatype[] arrayName = new datatype[size];
, where "new" is the keyword to instantiate the array.
Array Usage
- Accessing array elements involves indexing the array name.
- Two primary steps for using an array are declaration/initialization and assigning/accessing values.
Selection Structures
- Involves Boolean data types, relational operators for comparisons, and logical operators for forming complex conditions.
- Boolean data types can only hold true or false values.
- Relational operators compare operands, yielding boolean results based on conditions.
- Logical operators create complex expressions involving multiple conditions.
Types of IF Structures
- IF structure is a single-branch choice mechanism that executes a block of code if a condition is true.
- IF/ELSE structure provides a two-branch option for executing one block of code if a condition is true, or another if false.
- IF/ELSE IF/ELSE provides multiple branching options, allowing for complex decision-making.
Code Blocks and Grouping
- Curly braces {} are used to group multiple statements in a code block.
- Code blocks organize functionalities such as methods or classes, clarifying related code functionalities in C#.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
Explore the fundamentals of looping structures in C#. This quiz covers key concepts such as 'While Loop', 'DoWhile Loop', and 'For Loop'. Test your knowledge and deepen your understanding of these essential programming concepts.