CCS 102 Reviewer PDF
Document Details
Uploaded by AdoredDahlia
Tags
Summary
This document provides a review of computer programming concepts, including low-level and high-level programming languages, different coding types, and software development methodologies.
Full Transcript
**CCS 102 REVIEWER** \*The act of writing computer programs is called computer programming. \*As we know, to communicate with a person, we need a specific language, similarly to communicate with computers, programmers also need a language is called Programming language. \*Language is a mode of co...
**CCS 102 REVIEWER** \*The act of writing computer programs is called computer programming. \*As we know, to communicate with a person, we need a specific language, similarly to communicate with computers, programmers also need a language is called Programming language. \*Language is a mode of communication that is used to share ideas, opinions with each other. \*A programming language is a computer language that is used by programmers (developers) to communicate with computers. It is a set of instructions written in any specific language (C, C++, Java, Python) to perform a specific task. Programming Language and its types -Low-level programming language \* machine-dependent \* directly without the need of a compiler or interpreter \* divided into two parts: A.) Machine Language \- also called as machine code or object code. \- normally based in binary or hexadecimal B.) assembly Language -designed for specific processor \- uses abbreviation \- represents the set of instructions in a symbolic and human- understandable form. \- programming language uses "abbreviations" or mnemonics \- need to convert in machine language before computer can execute it \- High level programming language (HLL) \* Design for developing user friendly \* requires compiler or interpreter \* use English-like language \* need to convert in machine language before computer can execute it \* easy to read, write, and maintain. Low Level vs. High Level Languages High-level languages are easier to understand and use while low-level languages are difficult. Low-level languages are more efficient (programs written in low-level languages are better in terms of speed and hardware utilization) than high-level languages. Types of codes 1\) ASCII American Standard Code for Information Interchange requires only seven bits for each character 2\) EBCDIC Extended Binary Coded Decimal Interchange Code an alternative 8-bit code used by older IBM mainframe computers 3\) UNICODE uses 8-, 16-, or 32-bits providing codes for 65,000 characters (represent the alphabets of multiple languages) and becoming popular 4\) Extended ASCII code makes use of a series of 0's and 1's to represent 256 characters (including letters for uppercase and lowercase, numbers, and symbols). System Software \- collection of programs designed to operate, control, and extend the processing capabilities of the computer itself \- prepared by the computer manufacturers \- written in low-level languages Application Software \- designed to satisfy a particular need of a particular environment \- may consist of a single program Data vs. Software \- Before, the term "software" is always associated to all non-hardware components of a computer. However, modern definitions made it clear that all documents, spreadsheets and even downloaded materials from the net are now classified as data. Source code - code written by the programmer Object code - machine language representation of the source code Linker - creates the executable code and combines program object code, object code from library routines and any other required system code into one addressable machine language file Software Development Life Cycle \- process used by the software industry to design, develop and test high quality soft wares. \- aims to produce a high-quality software SDLC is the acronym of Software Development Life Cycle. It is also called as Software Development Process. SDLC is a framework defining tasks performed at each step in the software development process. ISO/IEC 12207 is an international standard for software life-cycle processes. It aims to be the standard that defines all the tasks required for developing and maintaining software. What is SDLC? \- process followed for a software project, within a software organization. \- consists of a detailed plan describing how to develop, maintain, replace and alter or enhance specific software. \- life cycle defines a methodology for improving the quality of software and the overall development process. A typical Software Development Life Cycle consists of the following stages: Stage 1: Planning and Requirement Analysis Stage 2: Defining Requirements Stage 3: Designing the Product Architecture Stage 4: Building or Developing the Product Stage 5: Testing the Product Stage 6: Deployment in the Market and Maintenance SDLC Models Waterfall Model - suggests that prior to proceeding to next phase, the current phase should be finished first. Modified Waterfall Model - allows overlap between phases Iterative Model - allows phases to repeat, if necessary \- Other related methodologies are Spiral Model, V-Model, Big Bang Model, Agile Model, RAD Model, Rapid Application Development and Prototyping Model. WEEK 2 Importance of Algorithms 1. To improve the efficiency of a computer program 2. Proper utilization of resources 3. Algorithms Program Development Life Cycle \- (PDLC) is a systematic way of developing quality software. \- provides an organized plan for breaking down the task of program development into manageable chunks \- divided into the steps discussed below: 1\) Defining the Problem 2\) Designing the Program Program Design Tools - Structure Charts -- A structure chart, also called Hierarchy chart, show top-down design of program. Each box in the structure chart indicates a task that program must accomplish. Algorithms An algorithm is a step-by-step description of how to arrive at a solution in the easiest way. Algorithms are not restricted to computer world only. In fact, we use them in everyday life. Flowcharts A flowchart is a diagram that shows the logic of the program. For example: Decision tables A Decision table is a special kind of table, which is divided into four parts by a pair of horizontal and vertical lines. Pseudocode ![](media/image2.png)-describe the way to arrive at a solution. They are different from algorithm by the fact that they are expressed in program language like constructs. 3\) Coding the Program 4\) Testing and Debugging the Program 5\) Documenting the Program 6\) Deploying and Maintaining the Program Programming Logic the formal systematic study of the principles of valid inference and correct reasoning Art of reasoning \- fundamental construct that\'s applied to computer science in a variety of comprehensive ways. \- logic involves logical operations on hard data that works according to logical principles and quantifiable results. \- general rests on a foundation of computational logic that is shared by both humans and machines Using Logic in Programming Inputs are instructions and data given to the computer. Outputs are the results of the inputs as returned by the computer. Arithmetic operations perform mathematical calculations on data. Conditional constructs determine if a result is true or false. Looping instructs the computer to move through a series of instructions until a condition is met. How Logic Helps in Programming \- Logic helps organize code and enables programs to run more efficiently when implemented properly. \- A well-written code helps the readability of the code. Algorithm \- step-by-step procedure, which defines a set of instructions to be executed in a certain order to get the desired output. \- generally created independent of underlying languages \- From the data structure point of view, following are some important categories of algorithms: Search -- Algorithm to search an item in a data structure. Sort -- Algorithm to sort items in a certain order. Insert -- Algorithm to insert item in a data structure. Update -- Algorithm to update an existing item in a data structure. Delete -- Algorithm to delete an existing item from a data structure. Characteristics of an Algorithm Unambiguous − Algorithm should be clear and unambiguous. Each of its steps (or phases), and their inputs/outputs should be clear and must lead to only one meaning. Input − An algorithm should have 0 or more well-defined inputs. Output − An algorithm should have 1 or more well-defined outputs, and should match the desired output. Finiteness − Algorithms must terminate after a finite number of steps. Feasibility − Should be feasible with the available resources. Independent − An algorithm should have step-by-step directions, which should be independent of any programming code. Pseudocode generic way of describing an algorithm without the use of any specific programming language syntax models and resembles real programming code can be written in a computer programming language but do not necessarily follow all the syntax rules of any specific language also called Program Design Language (PDL), WEEK 3 Variables Declaration and Initialization Types of Variables Local Variables: These are declared within a method, constructor, or block and can only be used within that specific scope. Instance Variables: Also known as non-static fields, these variables are declared within a class but outside any method. Class Variables: Also known as static fields, these variables are declared with the static keyword inside a class but outside any method. Naming Conventions Java has specific conventions for naming variables to enhance code readability and maintainability: Scope and Lifetime \* refers to the region of the program where the variable is accessible. \* refers to the duration during which the variable exists in memory. Local Variables: Limited to the block or method in which they are declared and exist only for the duration of that block or method. Instance Variables: Exist as long as the object to which they belong exists. Class Variables: Exist for the lifetime of the program and can be accessed through the class name or objects of the class. Data Types \* define the kind of data that can be stored and manipulated within a program. \* statically-typed language, which means that all variables must be declared with a specific data type before they can be used. Java provides a wide range of data types, which are broadly categorized into two groups: Primitive Data Types and Reference Data Types. 1\. Primitive Data Types are the most basic types available in Java. There are eight primitive data types, each of which has a specific size and range: 2\. Reference Data Types refer to objects and arrays. Unlike primitive data types, reference data types do not store the actual data value WEEK 4 Unary Operators \* are operators that operate on a single operand to produce a result. Types of Unary Operators 1\) Increment Operator (++) \- increment operator increases the value of a variable by one. \- be used in two forms: Prefix (++x) & Postfix (x++): 2\) Decrement Operator (\--) \- decreases the value of a variable by one. \- It also has two forms: Prefix (\--x) & Postfix (x\--) 3\) Unary Plus Operator (+) \- operator is a redundant operator in Java. 4\) Unary Minus Operator (-) \- negates the value of the operand. 5\) Logical Complement Operator (!) \- also known as the logical NOT operator, inverts the value of a boolean expression. If the expression is true, it returns false, and if the expression is false, it returns true. Arithmetic Operators \- used to perform mathematical calculations in Java. \- They can operate on any numerical data type, including int, float, double, and long. Types of Arithmetic Operators 1\) Addition (+) \- The addition operator + is used to add two operands. 2\) Subtraction (-) \- The subtraction operator - subtracts the second operand from the first. 3\) Multiplication (\*) \- The multiplication operator \* multiplies two operands. 4\) Division (/) \- The division operator / divides the first operand by the second. 5\) Modulus (%) The modulus operator % returns the remainder of the division of the first operand by the second. Assignment Operators \- are used to assign values to variables. Types of Assignment Operators 1\) Simple Assignment (=) The simple assignment operator = is used to assign the value on its right to the variable on its left. 2\) Addition Assignment (+=) The addition assignment operator += adds the right-hand side value to the left-hand side variable and assigns the result to the left-hand side variable. 3\) Subtraction Assignment (-=) The subtraction assignment operator -= subtracts the right-hand side value from the left-hand side variable and assigns the result to the left-hand side variable. 4\) Multiplication Assignment (\*=) The multiplication assignment operator \*= multiplies the left-hand side variable by the right-hand side value and assigns the result to the left- hand side variable. 5\) Division Assignment (/=) The division assignment operator /= divides the left-hand side variable by the right-hand side value and assigns the result to the left-hand side variable. 6\) Modulus Assignment (%=) The modulus assignment operator %= takes the remainder of the division of the left-hand side variable by the right-hand side value and assigns the result to the left-hand side variable. Relational Operators \- used to compare two values or expressions. \- These operators return a boolean value (true or false) based on the result of the comparison. Types of Relational Operators 1\) Equal to (==) \- checks if the values of two operands are equal. If they are, the result is true; otherwise, it is false. 2\) Not equal to (!=) \- checks if the values of two operands are not equal. If they are not equal, the result is true; otherwise, it is false. 3\) Greater than (\>) \- checks if the value of the left operand is greater than the value of the right operand. If it is, the result is true; otherwise, it is false. 4\) Less than (\=) \- checks if the value of the left operand is greater than or equal to the value of the right operand. If it is, the result is true; otherwise, it is false. 6\) Less than or equal to (\