System Programming Midterm CIS 340

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What is ethics?

Behavior with a positive or negative impact on society, its citizens and environment.

As professionals

Benefit others Improve situation Higher order of care

&&

Called Logical AND operator. If both the operands are non-zero, then the condition becomes true.

Why debug your code?

It allows a programmer to: Observe the execution of a program, pausing it while it runs, in order to examine the values of variables. Determine if and when specific lines of code are executed. Step through a program, executing it one line at a time, in order to observe program flow through branches.

what does the '..' or dotdot mean in directories?

It indicates a directory one level up

What does Creat do

It opens filename for writing. It sets the permission bits for the file with the value of the second argument - fd = creat("address", 0644)• If the file doesn't exist, the permission bits are set to rw-r--r--.• If the file exists, the file is now empty, and the permission mode doesn't change.

<<=

Left shift AND assignment operator. C <<= 2 is same as C = C << 2

>>=

Right shift AND assignment operator. C >>= 2 is same as C = C >> 2

ACM Code of Ethics

1. Contribute to society and human well-being. 2. Avoid harm to others. 3. Be honest and trustworthy. 4. Be fair and take action not to discriminate. 5. Honor property rights including copyrights and patents. 6. Give proper credit for intellectual property. 7. Respect the privacy of others. 8. Honor confidentiality.

How many bits are in a byte?

8

||

Called Logical OR Operator. If any of the two operands is non-zero, then the condition becomes true.

What is System programming

System programming is the use of system tools during program development.

How many bytes do variables use?

char is 1 byte int and a float are both 4 bytes double is 8 bytes *[any var] is 4 bytes

What is a Memory Map?

A memory map is a table, listing all the variables in a piece of code. - The table includes the variable names, values, and memory addresses. Address starts at 400

who does the command who work?

It inspects a utmp file, with is a file with all the history of all the logins sense the file was last created

what do mode links owner group size last-modified name of file of ls -l mean?

mode: the first character '-' indicates a regular file and'd' indicates a directory. The remaining nine characters are access permissions as read, write and execute a file for user, group, and everyone else. • links: It is a reference to a file. • owner: each file belongs to a user and its username of owner is shown. • group: each file belongs to group of users. • size: the number of bytes in the file name. • Last-modified: Three strings represent the last-modified time. • name: the name of the file is shown.

Debugging(What is next or step)

the debugger goes line by line though the code

What is a shell

A shell is a program that allows the user to run other programs. - It is usually executed in a terminal. • A variety of shells have been developed over the years. - Some examples include sh, csh, tcsh, ksh, and bash. - On a Windows system, there is a very simple shell called console, sometimes called DOS console or command Prompt.

What are the three parts of UNIX

An UNIX operating system is usually made up of three parts: • The kernel • The shell • Files and processes

What are the personal responsibilities of professional engineers

Benefit others Improve situation Higher order of care

&

Binary AND Operator copies a bit to the result if it exists in both operands.

<<

Binary Left Shift Operator. The left operands value is moved left by the number of bits specified by the right operand.

|

Binary OR Operator copies a bit if it exists in either operand.

~

Binary One's Complement Operator is unary and has the effect of 'flipping' bits. (Binary NOT)

>>

Binary Right Shift Operator. The left operands value is moved right by the number of bits specified by the right operand.

^

Binary XOR Operator copies the bit if it is set in one operand but not both.

&=

Bitwise AND assignment operator. C &= 2 is same as C = C & 2

^=

Bitwise exclusive OR and assignment operator. C ^= 2 is same as C = C ^ 2

|=

Bitwise inclusive OR and assignment operator. C |= 2 is same as C = C | 2

!

Called Logical NOT Operator. It is used to reverse the logical state of its operand. If a condition is true, then Logical NOT operator will make it false.

What are the two control Flow statements

exit(immediately terminates the program) and goto(jumps program execution to the named line of code)

%=

Modulus AND assignment operator. It takes modulus using two operands and assigns the result to the left operand. C %= A is equivalent to C = C % A

Who: Open, read, and close

Open: If kernel fails, return -1, if successful, return fd(small positive number is returned called file descriptor) Read:read system call asks the kernel to transfer qty(number of bytes to transfer) bytes of data from fd(source of data) to the array buf(destination for data) Close: When you are done reading/writing data to a file descriptor, you close it. (return 0) all return -1 if error

What are the three basic loops in C

or, while, and do-while

What is the goal of Ethics

Provides an aid to individual decision making intellectual property privacy confidentiality professional quality fairness or discrimination liability software risks conflicts of interest unauthorized access to computer systems

Why use Unix/Linux over windows

The Windows operating system is designed to simplify computer usage. - Windows computer is essentially a closed system. - Microsoft publishes limited information on the internal workings and design of Windows. • Unix is an open source, so that all details of its inner workings can be studied. - It is free - It's fully customizable - It's stable (i.e. it almost never crashes)

What does the break statement do?

The break statement terminates the loop and immediately proceeds to the next line of code following the loop.

What does the continue statement do?

The continue statement returns control to the beginning of the loop, testing the loop conditional to start the next iteration

Debugging(What is continue)

The debugger executes until either • a breakpoint is reached • the program exits normally, or • the program reaches a line of code doing something illegal

The role of the Operating System

The operating system is to manage and protect all the resources and to connect to the various programs.

How does the command who work?

The program needs to - Read structs from a file. - Display the information stored in a struct . • Use open, read, and close system calls - To extract log in records from the utmp file.

what does the command cp do?

It copies from source to target file $ cp source-file target-file

what does the '.' or dot mean in directories?

It signifies the current directory

What are three things the debugger can help with in your code

- Program crashes - Program Stuck in an Infinite Loop - Program Working Partially or Incorrectly Debugger can assist the programmer in finding errors in the implementation or due to unanticipated details.

What is Unix?

UNIX is a computer operating system, a control program that works with users to • run programs, • manage resources, and • communicate with other computer systems

what does ls -l do(command)?

It shows a list of files with the information of mode links owner group size last-modified name of file

What does who(command) do?

Each line represents one log-in session. - The username of the user. - Name of the terminal at which the user is logged in. - When the person logged in. - Where the user logged in.

Why must a program specifically be compiled for debugging to be able to execute that program in a debugger? What two things does the compiler do to assist a debugger?

It optimizes the code. This tells the compiler that the executable file is intended for debugging. The compiler will store additional information about the program, called a symbol table. Symbol table, you can inspect line by line through your code using Step, and it creates the executable that is optimized for debugging

What signifies the end of a string?

Where a value of '\0' signifies the end of the string.


Set pelajaran terkait

Cross Cultural Organizational Psychology

View Set

RN Adult Medical Surgical Online Practice 2023 B

View Set

Week 8 C++ Inheritance and MultiInheritance

View Set

HISTORY: Cold War Worksheet 1: The Berlin Blockade

View Set

Unit Review: A Look Back. WARNING: THIS SET IS ONLY FOR PEOPLE WHO WANT TO STUDY HARD.

View Set