Podcast
Questions and Answers
What is the correct file suffix for a C language program file?
What is the correct file suffix for a C language program file?
Which step follows the writing and saving of a C program?
Which step follows the writing and saving of a C program?
Which of the following compilers automatically handles both compilation and linking in one command?
Which of the following compilers automatically handles both compilation and linking in one command?
If the compilation of a C program is successful, what will it create?
If the compilation of a C program is successful, what will it create?
Signup and view all the answers
What is the purpose of a linker in C programming?
What is the purpose of a linker in C programming?
Signup and view all the answers
Which of the following correctly represents how to declare multiple integer variables in C?
Which of the following correctly represents how to declare multiple integer variables in C?
Signup and view all the answers
What is the purpose of the semicolon in a C program?
What is the purpose of the semicolon in a C program?
Signup and view all the answers
What does the %d format specifier do in a printf statement?
What does the %d format specifier do in a printf statement?
Signup and view all the answers
In C programming, which statement is true regarding variable usage?
In C programming, which statement is true regarding variable usage?
Signup and view all the answers
Which of the following statements accurately describes the main function in a C program?
Which of the following statements accurately describes the main function in a C program?
Signup and view all the answers
What is the purpose of including stdio.h in a C program?
What is the purpose of including stdio.h in a C program?
Signup and view all the answers
In C programming, how are code statements grouped together?
In C programming, how are code statements grouped together?
Signup and view all the answers
What is the purpose of a compiler in programming?
What is the purpose of a compiler in programming?
Signup and view all the answers
What is the primary characteristic of high-level programming languages?
What is the primary characteristic of high-level programming languages?
Signup and view all the answers
Which statement about files in a computer is true?
Which statement about files in a computer is true?
Signup and view all the answers
How is data interpreted from a byte like 01000110?
How is data interpreted from a byte like 01000110?
Signup and view all the answers
What is the role of a linker in program development?
What is the role of a linker in program development?
Signup and view all the answers
In what form is a program executed by a computer?
In what form is a program executed by a computer?
Signup and view all the answers
What does a bit represent in a computer system?
What does a bit represent in a computer system?
Signup and view all the answers
Which of the following describes a program's structure?
Which of the following describes a program's structure?
Signup and view all the answers
Study Notes
Course Introduction
- Course title: Programmeringsteknik DT143G
- Lecture 1: Introduction
- Course responsible: Pascal Rebreyend
- Date: 4-11-2024
- Location: Örebro University
- Lectures: 15 lectures (2 * 45 minutes)
- Labs: 6 lab sessions, 2 students per group
- Lab software: Labs will be available on Blackboard soon.
- Course materials: BB Learn
- Course instructor office: T2232
- Course instructor email: [email protected]
- Number of assistants: 2
Course Contents
- Practical information
- Organization of the course
- First contact with programming
- The spirit of the subject
- Goals of the course
Course Materials
- Main textbook: C från Början by Jan Skansholm
- References:
- Programmeringsmetodik C by Gunnar Joki
- The C programming Language by Brian W. Kernighan and Dennis M Ritchie
- Other online materials available
Lectures and Labs
- Deadlines
Criteria to Pass the Course
- Approved written exam (some questions)
- 50% of points: grade 3, 70-75% grade 4, 85-90% grade 5
- Approved labs: Labs 3, 4, 5, and 6
Computers and Programs
- Computer components and functions are illustrated
- Calculations are done
- System diagram: Input/Output, CPU (Control Unit + Arithmetic Logic Unit (ALU)), Primary Memory (RAM, ROM), Secondary Memory (Hard Disk)
Primary Memory
- RAM (Random Access Memory): Stores data while the computer is running. Data is lost when the computer is switched off.
- ROM (Read-Only Memory): Holds instructions/data programmed by the manufacturer. Cannot be altered by the user.
Computers and Input-Output
- Input Entity: Used to enter data (e.g., keyboard, mouse, sensors)
- Output Entity: Used to display or output results (e.g., screen)
Secondary Memory
- Stores data when the computer is off.
- Higher capacity than primary memory.
- Slower than primary memory.
Computers and Data
- Data is stored in bits (0 or 1).
- 8 bits = 1 byte
- Conversions: Binary to decimal, decimal to hexadecimal
- ASCII codes represent characters.
Files
- Data on the hard drive is in the form of files.
- Each file is a sequence of bytes.
- Files are identified by a name (e.g. myfile.exe, anotherfile.docx).
- Folders (directories) are used to organize files.
- Folders contain files and other folders
Program
- Instructions that tell the computer what to do.
- Loaded into memory and executed one by one.
- Each instruction has a set of bytes representing it.
Programming Language
- Computers understand machine code (0s and 1s).
- Assembly language: one instruction per line.
- High-level languages (e.g., C, C++, Java): Closer to human language, contain rules/syntax, and use concepts similar to each other .
Developing a Program (Basic Way, C)
- Write the program in a text editor.
- Save it with the .c extension.
- Compile the program to generate an object file (helloworld.o / helloworld.obj).
- Link the object file with other programs to create the executable file (a.out (Linux) / helloworld.exe (Windows)).
- Run the executable program.
- Some languages are interpreted (translation line by line) vs compiled (into machine code).
C Language
- Developed by Dennis Ritchie in 1972.
- High-level language, closely related to hardware.
- Used to develop operating systems and embedded systems.
- Powerful but demands careful programming.
- Widely used language
Example: Hello World
- Code example* of a program that displays "Hello World" on the screen
Programming in C
- gcc (GNU Compiler Collection): Common compiler for C on Unix/Linux systems.
- Usage: Compilation and linking are often combined into one command.
- IDEs (Integrated Development Environments) exist but are not necessary to learn the language.
Explanations
- stdio.h file: Contains definitions for standard input/output functions.
- Predefined functions such as printf are already defined.
C Programming
- Character to jump to next line: (e.g., \n).
- Curly brackets: Group code statements into blocks (e.g., { code }).
- Semicolons: End each C code statement (e.g., a=5;).
- Whitespace (e.g., spaces, tabs): Ignored by the compiler.
Variables
- Programming involves computations on variables.
- Variables: Allocated spaces in memory to store values
- Variables must be declared with types (e.g., int, double, float, char).
Variables in C
- Variables must be declared before use.
- Data types ( int, double, etc. ) must be specified when declaring variables
A Simple Example
- Example code showing how to declare and use an integer variable ('x').
Conclusion
- C is an important programming language.
- Practice is necessary to become a proficient programmer.
- Learn the program syntax.
- Using software (gcc, emacs, Geany, Atom) for development
- Programming is a skillset applicable across fields
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
This quiz covers the introduction to the Programming Techniques course DT143G, presented by Pascal Rebreyend. It includes details about the course structure, materials, and initial goals of programming. It is designed for students to familiarize themselves with the course landscape and expectations.