CCS 102 Computer Programming 1 Lecture Notes PDF

Document Details

SustainableWerewolf

Uploaded by SustainableWerewolf

Holy Name University Bohol, Philippines

2021

Tags

computer programming programming languages introduction to programming computer science

Summary

This document is a lecture on computer programming, specifically the introduction to programming languages.  It covers topics including levels of programming languages (low-level and high-level), and typical programming errors.  It's a good overview of fundamental programming concepts.

Full Transcript

CCS 102 COMPUTER PROGRAMMING 1 Introduction to Programming Languages CCS 102 Copyright © 2021 HNU-Department of Computer Studies 1 Introduction to Programming Languages A. Overview Computer hardware by itsel...

CCS 102 COMPUTER PROGRAMMING 1 Introduction to Programming Languages CCS 102 Copyright © 2021 HNU-Department of Computer Studies 1 Introduction to Programming Languages A. Overview Computer hardware by itself is useless without any Software (computer programs) A computer program is a collection of instructions that performs a specific task when executed by a computer. a list of instructions that tell a computer what to do a set of instructions to a computer telling it to do a particular piece of work Any programming language is used to create computer programs A specific programming language has its own rules when writing a program These rules should be followed, otherwise the program would not work These set of rules is called the syntax of the language CCS 102 Copyright © 2021 HNU-Department of Computer Studies 2 Introduction to Programming Languages B. Levels of programming languages programmer The fundamental language of the computer’s processor, also instructions called Low Level Language. All programs (written in other levels) are converted into machine language before they can be executed. Consists of combination of 0’s and 1’s that represent high and low electrical voltage. Machine language hardware CCS 102 Copyright © 2021 HNU-Department of Computer Studies 3 Introduction to Programming Languages B. Levels of programming languages programmer A low level language that is similar to machine language. Uses symbolic operation code (mnemonic codes) to instructions represent the machine operation code. The program written in this language needs to be translated (assemblers) Assembly language Machine language hardware hardware CCS 102 Copyright © 2021 HNU-Department of Computer Studies 4 Introduction to Programming Languages B. Levels of programming languages Computer (programming) languages that are easier to learn. programmer Considered high-level because they are closer to human languages and farther from machine languages. Uses English-like statements instructions The program written in this language needs to be translated High-level language Assembly language Machine language hardware hardware CCS 102 Copyright © 2021 HNU-Department of Computer Studies 5 Introduction to Programming Languages B. Levels of programming languages instructions programmer CCS 102 Copyright © 2021 HNU-Department of Computer Studies 6 Introduction to Programming Languages Review Questions 1. What is a program? 2. What is syntax? 3. What are the 3 levels of programming languages? 4. What is the advantage and the drawbacks of a machine language? 5. What are the advantages and the drawbacks of high-level languages? CCS 102 Copyright © 2021 HNU-Department of Computer Studies 7 Introduction to Programming Languages C. High-level languages There are hundreds of high-level programming languages that can be programmer used Popular languages: Java, C, C++, instructions Python, PHP, Perl, Ruby, C# Programs written in high-level languages need to be translated into machine codes. Two types of translators: Compiler and Interpreter CCS 102 Copyright © 2021 HNU-Department of Computer Studies 8 Introduction to Programming Languages C. High-level languages CCS 102 Copyright © 2021 HNU-Department of Computer Studies 9 Introduction to Programming Languages C. High-level languages Every programming language has its own translators programmer Program written in C source code instructions C compiler Machine code executable code Hardware CCS 102 Copyright © 2021 HNU-Department of Computer Studies 10 Introduction to Programming Languages D. Program Errors When a program is run, it may have some errors. Program written in C source code happens when the rules of the programming C compiler syntax error language used are not followed. Machine code executable code the code will not be Hardware compiled CCS 102 Copyright © 2021 HNU-Department of Computer Studies 11 Introduction to Programming Languages D. Program Errors When a program is run, it may have some errors. a bug in a program that causes it to operate Program written in C source code incorrectly, but not to terminate abnormally (or C compiler crash produces unintended or Machine code executable code undesired output or other behavior, although it may Hardware logical error not immediately be recognized as such CCS 102 Copyright © 2021 HNU-Department of Computer Studies 12 Introduction to Programming Languages D. Program Errors When a program is run, it may have some errors. Software or hardware problem that prevents a Program written in C source code program from working correctly C compiler User might lose Machine code executable code information in the file that he is working on Hardware runtime error prevents a user from using a feature. CCS 102 Copyright © 2021 HNU-Department of Computer Studies 13 Introduction to Programming Languages Review Questions 1. What is the role of translators in programming? 2. Explain the programming process from coding of the program up to execution of the program. 3. What are the 3 possible errors that might be encountered in the programming process? When will each error occur? CCS 102 Copyright © 2021 HNU-Department of Computer Studies 14

Use Quizgecko on...
Browser
Browser