Quiz 3

Description

Covers Looping logic, Call to method & Method signature , Arrays
Shahmeran Gilani
Mind Map by Shahmeran Gilani, updated more than 1 year ago
Shahmeran Gilani
Created by Shahmeran Gilani over 9 years ago
4
0

Resource summary

Quiz 3
  1. Three main types of looping
    1. Do-While loop
      1. Used when you need to loop at least once
        1. Loop is considered a "Post test" loop
          1. Logic- Carry out this set of code WHILE this condition is false
          2. While loop
            1. Used when you are unsure of long you need to loop for
              1. Loop is considered a "Pre test" loop
                1. Condition is checked before the loop is executed
                  1. Condition must be initialized from before for this loop to occur
                  2. Logic: While the counter is not met, DO the code and update the counter
                  3. For loop
                    1. Used when you know how many iterations you need in a loop
                      1. Loop is considered a "Pre test" loop
                        1. Combines loop control into one statment.
                          1. removes loop control from body of loop
                            1. Less chance of messing up counter options as is declare before hadn
                        2. Flow control of loops
                          1. Counters are used when we want a certain piece of code to occur only a set number of time. Counters are used best with While loops but can be used with other loops also
                          2. Methods
                            1. Code block that contains many statements
                              1. Three ways of depicting methods
                                1. Method signature
                                  1. Has a type
                                    1. Brief description of what method does
                                      1. Has a name and parameters
                                        1. parameters are place holders
                                        2. [return type] + [name of method]+(parameters)
                                        3. Call to the method
                                          1. has a name but no type
                                            1. instead of parameters (as placeholders) it has arguments
                                              1. [name] +(arguments)
                                              2. Method Declaration
                                                1. contains comments
                                                  1. Includes Method signature
                                                    1. contains the "scope" or body of code within the method signature
                                                  2. Types of methods
                                                    1. Methods that take no parameters and return nothing
                                                      1. Consone.WriteLine()
                                                      2. Methods that take a parameter but do nothing
                                                        1. Console.Writeline("Hello")
                                                        2. Methods that take no parameters but do something
                                                          1. age =int.parse(Console.Readline())
                                                        3. Method Overloading
                                                          1. Using a method with the same name but different parameters
                                                            1. Useful to distinctly use the same method with different data types
                                                            2. Methods that are of the void type do not need a return method
                                                            3. General information
                                                              1. Refactoring is when you take a existing solution and change it into a new solution
                                                                1. Methods must have a return statement for them to return a value. anything after the return statement is ignored!
                                                                  1. Debugging
                                                                    1. Step Into
                                                                      1. Used when you want to see what is happening inside the code
                                                                        1. Used to check the code flow
                                                                        2. Step over
                                                                          1. Allows debugger to continue
                                                                            1. Used as a high level approach
                                                                        3. Arrays
                                                                          1. used to store values
                                                                            1. Passed as a reference and not as a whole!
                                                                              1. created as such: int[] numbers = new int[];
                                                                                1. New is a operator used to create objects
                                                                                2. Length
                                                                                  1. If Array is filled then use array.length;
                                                                                    1. Two ways of determining length of elements in array if its partially filled
                                                                                      1. Ask user for length and store it
                                                                                        1. Take in values of array and after each uptake ask user if they want to add more , provided the array is not full
                                                                                    Show full summary Hide full summary

                                                                                    Similar

                                                                                    Final Quiz 3
                                                                                    Madalyn Geuke
                                                                                    Quiz #3
                                                                                    rubenetulodii
                                                                                    2W151 Volume 1: Administration, Management, and Publications - Quiz 3
                                                                                    Joseph Whilden J
                                                                                    Quiz 3
                                                                                    Chandrika B