46 Pages

Lecture 1.17.08

Course: EE 312, Spring 2008
School: University of Texas
Rating:
 
 
 
 
 

Word Count: 3229

Document Preview

Lecture EE312 2 Announcements Topics for today will answer the questions: Survey Results What is the C programming language ? What is C syntax ? What is C s nta ? Assignment statement Numerical expressions Numerical expressions Number storage formats (in Ch. 7) Will use formatted IO functions: printf(), scanf() These are in Ch. 3 and will be covered next time 1 Overall Score (out of 5) Overall Score...

Register Now

Unformatted Document Excerpt

Coursehero >> Texas >> University of Texas >> EE 312

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Lecture EE312 2 Announcements Topics for today will answer the questions: Survey Results What is the C programming language ? What is C syntax ? What is C s nta ? Assignment statement Numerical expressions Numerical expressions Number storage formats (in Ch. 7) Will use formatted IO functions: printf(), scanf() These are in Ch. 3 and will be covered next time 1 Overall Score (out of 5) Overall Score (out of 5) 0% 4% 14% 5 42% 19% 4 3 2 1 0 21% 2 306 Questions 306 Questions 2% 25% 2 1 0 73% 3 3 Programming Experience Programming Experience 1.2 1 Percentage of Class 0.8 0.6 0.4 0.2 0 Java C++ C Web 0 months < 6 months < 6 months 612 months 1218 months 1824 months > 24 months Other Languages Mentioned: Cobol, Tcl/Tk, Basic, VB 4 Introducing C Introducing C The history The basics of the language 5 The History of C Designed and implemented by Dennis Ritchie of Bell Labs between 1969 and 1973 Created as the implementation language for UNIX Named after the B language, its immediate predecessor B was originally named after the BCPL language Became popular during the 1980s, both for UNIX p g programming and for developing applications for PCs g p g pp 1980 Bjarne Stroustrup created "C with classes" Led to C++ Dennis Ritchie's article, "The Development of the C Language," can be found on the web at cm belllabs com/cm/cs/who/dmr/chist html cm.belllabs.com/cm/cs/who/dmr/chist.html. 6 Versions of C K&R C Described in Kernighan and Ritchie, The C Programming Described in Kernighan and Ritchie, The C Programming Language, Prentice Hall, 1978 ANSI C (ISO C, C89) ANSI standard X3.1591989 (completed in 1988; formally approved in December 1989) International standard ISO/IEC 9899:1990 / Described in Kernighan and Ritchie, The C Programming Language, Second Edition, PrenticeHall, 1988 C99 International standard ISO/IEC 9899:1999 Slight variations by compiler maker Slight variations by compiler maker 7 The C Language Syntax and Semantics Syntax and Semantics Syntax: Form, grammar, lexical structure. Very precise. Form grammar lexical structure Very precise Will give syntax rules for constructs of the language. Larger constructs are built from smaller constructs. Larger constructs are built from smaller constructs THIS PART IS FRUSTRATING!! Semantics: The constructs have meaning and behavior. A particular element of the language causes the A particular element of the language causes the computer to make something happen. THIS PART IS CHALLENGING!! We will focus on syntax and structure today 8 Syntactic Analogy y gy English Paper Theme paper Paragraphs g p Sentences Words/punctuation Symbols from the English alphabet C Program Program Functions Statements Words/punctuation Words/punctuation (aka, tokens) Symbols from the C alphabet From larger to smaller constructs 9 Structure of a C Program Contains one or more named functions, one of which is the main function (i.e., the place to start execution) A f ti i A function is a named (sub)unit containing a set of statements that d ( b) it t i i t f t t t th t operate on data to produce a specific result The block of statements in a function are executed in sequence, one after the other ft th th Each statement consists of legal words, symbols and p punctuation (tokens) from the C alphabet ( ) p Some statements are executable, some not A statement ends with a ";" #include <stdio.h> int main(void) { printf ( "Hello World \n"); return 0; } 10 Hello World Important Points about Syntax C is case sensative. Hello, hello, and HELLO are all different Words in C are delimited by blank(s), punctuation, an operator or other symbol C has a free form layout. Hello World could be written as: #include <stdio.h> int main(void) {printf( Hello World \n ); return 0;} #include <stdio h> int main(void) {printf( "Hello World \n"); return 0;} Or with every token (word, symbol, etc.) on a separate line Style guidelines dictate that a program should be written and presented in a way that is easy for others to read. including yourself when you go back to a program months or years later. Using good style will be part of your assignment grades (later). The Layout of a Simple C Program The simplest C programs have the following form: int main(void) ( ) { declarations statements } The word int may be omitted (although it's good practice) ( ) The use of void is also optional Each declaration and each statement (except for compound Each declaration and each statement (except for compound statements) must end with a semicolon Each variable must be declared before it is used for the first time 12 Basic Types of Statements Declaration statement Variables must be described before used Assignment statement Variables are given new values during execution Function header definition Function call Return statement Comments Preprocessor directives Selection statements Looping statements 13 Simple Example Program /* Illustrates comments, strings, and the printf function */ #include <stdio.h> int main(void) { printf ("Greetings from your program:"); printf ( Hello World \n ); printf ("Hello World \n"); return 0; } What are each of the language elements seen here in this example program? this example program? 14 The Layout of a Larger C Program y g g The layout for a multifunction C program: #include directives #define directives Declarations of external variables Declarations of function interfaces (other than main) Definition of main Definitions of other functions More on this after we talk about writing functions More on this after we talk about writing functions 15 Advantages and Disadvantages of C g g Advantages Efficient Efficient Portable Powerful Flexible Fl ibl Standard library Integrated well with UNIX Disadvantages Errorprone Error prone Difficult to understand Difficult to maintain Difficult to maintain Recommendations Use tools (IDE, lint, debuggers, etc.) to make programs more reliable more reliable Use libraries of existing code (to save time and increase reliability) Adopt a sensible set of coding conventions Avoid programming "tricks" and complicated code 16 Comments Begin with /* and end with */. /* This is a comment */ May extend over more than one line. /* This comment starts on one line, but ends on another. */ / Warning: Failing to close a comment will cause the compiler to ignore part of your program. printf("Hello"); /* forgot to close this comment... f(" ll ") /* f l h ... printf("Goodbye"); /* so it ends here */ In C99, comments can also be written in the following way: // This is a one line comment. This type of comment is terminated by the end of the line This type of comment is terminated by the end of the line. 17 Identifiers An identifier is a symbolic name for a program element Identifiers may contain letters, digits, and underscores must begin with a letter or underscore t b i ith l tt d usually best to avoid identifiers that begin with an underscore Examples of legal identifiers: p g times10 get_next_char _done d Examples of illegal identifiers: 10times getnextchar C is casesensitive 18 Variables A variable is a symbolic name for a value that can change Variable names must be legal identifiers y Variables must be declared before they are used. Variables can be declared one at a time: int height; int length; int width; int volume; int volume; or several at a time: int height, length, width, volume; 19 Variables (2) Variables (2) Always initialize variables before using them. Always initialize variables before using them. Wrong way: int height; printf("The height is %d\n", height); Right way: int height; g ; height = 5; printf("The height is %d\n", height); An initial value can be specified in adeclaration: int height = 5; 20 Keywords These keywords may not be used as your identifiers: y They are reserved words that have a special meaning to the compiler il Keywords (with the exception of _Bool, _Complex, and Keywords (with the exception of Bool Complex and _Imaginary) and names of some library functions (e.g., printf) are written only in lowercase letters. auto break case char const continue default do double else enum extern t float for goto if inline* int long register i restrict* return short signed sizeof static struct str ct switch typedef union unsigned void volatile while _Bool* _Complex* _Imaginary* *in C99 only 21 Builtin Data Types in C C uses two different types of numbers: integers (int): integers (int): ..., 2, 1, 0, 1, 2, .... 2 1 0 1 2 floating point numbers: 1.232, 3.14159, 1.4E12 two memory formats for these (float and double) two memory formats for these (float and double) Numbers can be stored in variables or can appear as literal values in a program appear as literal values in a program A variable is a symbolic name for a type of value that can change as your program runs that can change as your program runs The two non numeric data types are char and void more details on these basic data types later more details on these basic data types later 22 Data Declaration Statement Used to define a new variable of a particular type. Variable name is known in the function/block where declared This is the variable's scope This is the variable s scope Proper syntax: typeName variableName; Can also be a list of variableNames separated by ","s for a given typeName Initial values can optionally be supplied [ = expression] Initial values can optionally be supplied [ expression] Examples int year; float price; double radius; int a, b, c; int courseNumber = 312; char letterGrade; 23 Assignment Statement variableName = expression; expression can be a variable, a constant, a literal or a combination of these connected by operators (e.g. +, ). It can contain subexpressions. variableName must have been previously declared. The symbol is NOT equality in C. previously declared. The = symbol is NOT equality in C. x = 1; /*Assign the value 1 to x; */ x = x + 1; /* Add 1 to the current value of x;*/ radius = 1.0; /* A i 1 0 t di 1 0 /* Assign 1.0 to radius;*/ di */ If variableName and expression don't have the same type, then the value of the expression is converted before the assignment: the value of the expression is converted before the assignment: int i; float f; i = 72.99; /* i is now 72 */ f = 136; /* f is now 136.0 */ Assignment For example, the statements float total; int quarters; q ; total = 0.0; quarters = 12; total total + quarters 0.25; total = total + quarters * 0.25; /* What does this code do? */ float total = 0.0; int quarters, dimes, nickels, pennies; /*assume that above the have values now*/ total = quarters * .25 + dimes * .10 + nickels * .05 + pennies * .01; take the value in quarters, multiply it by 0.25, add that result to the value currently in total and place the result back into the variable named total named total any value in total before the assignment is overwritten by the new value. quarters 12 total 0.0 3.00 25 Assignment (cont.) Assignment is a true operator, just like + and * The value of v = e; is the value of v after the assignment. Assignments can be chained together: i = j = k = 0; The = operator is right associative, so this statement is equivalent to The = operator is right associative so this statement is equivalent to i = (j = (k = 0)); The assignment operator may appear inside any expression: i = 1; k = 1 + (j = i); printf( %d %d %d\n , i, j, k); / prints 1 1 2 / printf("%d %d %d\n", i, j, k); /* prints "1 1 2" */ Hiding an assignment inside a larger expression is not a good idea and is discouraged 26 Compound Assignment In addition to the simple assignment operator, C provides ten compound assignment operators, including: += = = /= %= += = *= /= %= E.g., the expression v += e; is equivalent to v = v + e; except that v is evaluated only once in the former expression The compound assignment operators have the same properties The compound assignment operators have the same properties as the = operator They're right associative and can be used in arbitrary expressions. The use of these operators is discouraged for use in your programs Examples: p i = 5; j ; j = 2; i += j; /* i is now 7 */ i = 5; j ; j = 2; i = j; /* i is now 3 */ i = 5; j ; j = 2; i *= j; /* i is now 10 */ i = 5; j ; j = 2; i /= j; /* i is now 2 */ i = 5; j ; j = 2; i %= j; /* i is now 1 */ 27 Defining Constants Two ways macro definition or using const in the d f h declaration A A macro definition has the form d fi iti h th f #define identifier replacementlist For example: o e a pe #define N 100 /* replace the symbol N with 100 throughout the program */ Macro definitions are handled by the C preprocessor (chapter 14) Examples: l #define EOF (1) #define TWO_PI (2 3.14159) #define TWO PI (2*3 14159) const int EOF = 1; const float TWO_PI 2*3 14159; const float TWO PI = 2 3.14159; 28 Defining Constants (2) Defining Constants (2) Advantages of defining constants: Advantages of defining constants: Programs are easier to read Programs are easier to modify Helps reduce errors of inconsistent use, as well as typographical errors Style issues by convention use all capital letters for constant identifiers and separate parts of the name with an underscore and separate parts of the name with an underscore "Magic numbers" should not appear in programs if you need to use a number besides 1, 0, 1, or 2 declare a y constant 29 Numeric Expressions N i E i 30 Arithmetic Operators The arithmetic operators are: + unary plus unary minus unary minus * multiplication / division % modulo division remainder + addition subtraction The value of i % j is the remainder when i is divided by j F For example, the value of 10 % 3 is 1; the value of 12 % 4 is 0 l th l f 10 % 3 i 1 th l f 12 % 4 i 0 The % operator requires integer operands; all other operators allow either integer or floatingpoint operands If both operands are integers, / truncates the result toward 0 There is no exponentiation operator in C 31 Operator Precedence When an expression contains more than one operator, the meaning of the expression may not be clear: Does i + j * k mean (i + j) * k or i + (j * k) ? In C, this potential ambiguity is resolved by the following operator precedence scheme Highest: + ( (unary) ) * / % Lowest: + Lowest: + (binary) Examples: i + j k means i + (j k) i + j * k means i + (j * k) i * j means (i) * (j) +i + j / k means (+i) + (j / k) 32 Associativity Operator precedence rules aren't enough when an expression contains two or more operators at the same level of precedence Binary arithmetic operators are all left associative (group from left to right); unary operators are right associative. f l f i h) i h i i Examples of associativity: i j k means (i j) k i j k (i j) i * j / k means (i * j) / k i j i + k means (i (j i)) + k i j * i + k means (i (j * i)) + k i means (i) All problems of ambiquity can be overcome by using ( ) All problems of ambiquity can be overcome by using ( ) 33 Increment and Decrement Operators The ++ and operators increment and decrement variables. Both operators are unary. Either operator can be prefix or postfix: ++i i++ i i i When used as a prefix operator, ++ increments the variable before p p its value is fetched: i = 1; printf("i is %d\n", ++i); /* prints "i is 2" */ printf("i is %d\n" ++i) /* prints "i is 2" */ You can't ++ or an You can t ++ or an expression Don't embed these inside of other expressions of other expressions (unclear semantics) Use these for counters and loop control dl t l 34 When used as a postfix operator, ++ increments the variable after its value is fetched: i = 1; printf( i is %d\n i++); /* prints i is 1 */ printf("i is %d\n", i++); /* prints "i is 1" */ The operator has similar properties Compute the Volume /* this program computes and outputs the volume of a box */ #include <stdio.h> int main(void) i t i ( id) { int height, length, width, volume; height = 5; length = 20; width 10; width = 10; volume = height * length * width; printf ("The height is %d\n", height); printf ("The length is %d\n", length); i tf ("Th l th i %d\ " l th) printf ("The width is %d\n", width); printf ("The volume is %d\n", volume); return 0; } 35 Converting Fahrenheit to Celsius /* program to convert a given fahrenheit temperature to celsius */ #include <stdio.h> #define FREEZING_PT 32.0 #define SCALE_FACTOR (5.0 / 9.0) int main(void) { double fahrenheit, celsius; double fahrenheit celsius; printf ("Enter Fahrenheit temperature: "); scanf ( %f , &fahrenheit); scanf ("%f", &fahrenheit); celsius = SCALE_FACTOR * (fahrenheit FREEZING_PT); printf ("\nCelsius equivalent is: %.1f\n", celsius); return 0; } 36 Converting Fahrenheit to Celsius /* program to convert a given fahrenheit temperature to celsius */ #include <stdio.h> int main(void) { const float FREEZING_PT = 32.0; const float SCALE_FACTOR = 5.0 / 9.0; double fahrenheit, celsius; double fahrenheit celsius; printf ("Enter Fahrenheit temperature: "); scanf ( %f , &fahrenheit); scanf ("%f", &fahrenheit); celsius = SCALE_FACTOR * (fahrenheit FREEZING_PT); printf ("\nCelsius equivalent is: %.1f\n", celsius); return 0; } 37 C's Numeric Type Categories yp g integer (whole numbers) fl i (f floating (fractional decimal) i l d i l) You have limited control over how much memory is used how that memory is used The details are in Ch. 7 38 Integers May be declared as signed or unsigned Left most bit used to indicate sign (in 2's complement format) 32 bit machine int format is: 01111111 11111111 11111111 11111111 Range signed: 231 to 2311 unsigned 0 to 2321 g You should use unsigned when number is nonnegative and additional magnitude is required 39 Integers (cont) g ( ) Control over memory usage int is the "natural" size of a specific computer what is most efficient for that cpu/memory short usually halves number of bits long usually increases number of bits o g usua y c eases u be o b ts For maximum portability use int (or short int) for integers that won t exceed 32,767 and long int for integers that won't exceed 32 767 and long int for all other integers. 40 Typical Integer Value Ranges 16bit Machine 16 bits short int unsigned short int 16 bits int unsigned int unsigned int 32 bits long int unsigned long int 32bit Machine 16 bits short int unsigned short int unsigned short int 32 bits int unsigned int 32 bits long int unsigned long int 32,768 0 2,147,483,648 0 2,147,483,648 0 32,767 65,535 65 535 2,147,483,647 4,294,967,295 2,147,483,647 4,294,967,295 41 Type Smallest Value 32,768 0 32,768 0 2,147,483,648 0 Largest Value 32,767 65,535 32,767 65,535 65 535 2,147,483,647 4,294,967,295 Integer Literals These are constant values that cannot be altered during program execution Th They may appear in one of three formats: i f th f t decimal (base 10, digits 09) 15, 255, 32767 octal (base 8, digits 07, must begin with 0) 017, 0377, 077777 hexadecimal (base 16 digits 0 9 a f must begin with 0x) hexadecimal (base 16, digits 09,af must begin with 0x) 0xf, 0xff, 0xfff hexadecimal digits may be in upper or lower case, 0xFf or 0xff or 0xFF O t l dh Octal and hex are mostly used in low level programs tl di l l l What happens if I put a zero in front of a decimal? 057 058 42 Integer Literals (cont) All forms (decimal, octal, hex) are all represented (internally) the same. 10 + 015 + 0x20 ??? Answer is 55 (in decimal) ( ) Representation Rules if value falls within int type int otherwise it's a long int To force long or unsigned representation, follow constant with U and/or L i h U d/ L For examples 15U 0377L 0x7ffffffffUL 15U 0377L 0x7ffffffffUL 43 Floating Point Capable of representing fractional numbers Numbers are stored in 3 parts: Numbers are stored in 3 parts: Sign bit (+ / ) Exponent (10n, number of bits size) Exponent (10 number of bits Fraction (number of bits precision) Three floating point formats are: Three floating point formats are: float d bl double long double single precision double precision d bl ii extended precision N l ll Nearly all engineering calculations should use i i l l i h ld double or long double 44 Floating Point Literals 57.0 57. 57.0e0 5.7e+1 .57e2 570.e1 Must contain decimal point and/or exponent By default stored as doubleprecision numbers F or f, L or l can be used to force storage format IEEE Standard 754 Floating Point Characteristics Type float float (32) double (64) Smallest Value (+) 1.17x10 38 1 17x1038 2.22x10308 Largest Value (+) 3.40x10 38 3 40x1038 1.79x10308 Precision Up to 6 digits Up to 6 digits Up to 15 digits long double is not defined by this standard and is usually 80 or 128 bits 45 C Math Library Functions See Ch. 23.3 and appendix D #include <math.h> Trig functions Hyperbolic functions Exponential functions Logarithmic functions Power functions Power functions Nearest integer Absolute value Absolute value Remainder functions Functions are called by name (valuespassed), e.g., double x; x = sqrt (3.0); /* x will be 1.73205 */ 46
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

University of Texas - EE - 312
Micro architecture, logic circuits, and device technology -1st layer hardware vs. software Machine assembly language instruction set machine code High level programming language - c programming Not finished Need the designModels, design, and abstr
University of Texas - EE - 312
Notes 1.17 The History of C Was called NB o BCPL Orignated from the UNIX System By Denins Ritchie in Bell Labs Between 1969 and 1973 Became popular in the 1980s Original C o Called K&amp;R C By Kernighan and Ritchie o ANSI C ANSI Standard X3.159-1989
University of Texas - EE - 312
Read Chapter 3, 7, 22 Know Chapter 2 for Quiz on FridayNotes 1.22 Floats Float single precision Double double precision Long double extreme precision Must contain decimal point or exponent By default stored as double-precision numbers F or f, L
University of Texas - EE - 312
EE 312 Notes January 24, 2008Selection o Deciding among alternative executive paths Boolean values stored in variables Tested by program Using If and Else Statements Nested and Cascaded If statements Using Switch Statements Conditional Operators
University of Texas - EE - 312
EE 312 Notes January 24, 2008Sequence Follow Sequence 1, 2, 3 Condition is True Do until false Iteration False loop back to beginSelection Condition is true go to end Condition is not true, then do functionSelection o Deciding among a
University of Texas - EE - 312
E E 312 Notes Argc = number of pointers Char *argv[] = each value that is pass into function Int main ( int argc, char *argv[]) Command line &gt;myprog.c one two three Argc = 4 Argv[0] = &quot;my prog.c&quot; Argv[1]=&quot;one&quot; Argv[2] = &quot;two&quot; Argv[3] = &quot;three&quot; File i
University of Texas - BIO - 311C
Chapter 7Membrane Structure and FunctionLecture OutlineOverview: Life at the Edge The plasma membrane separates the living cell from its nonliving surroundings. This thin barrier, 8 nm thick, controls traffic into and out of the cell. Like all
University of Texas - BIO - 311C
Chapter 13Meiosis and Sexual Life CyclesLecture OutlineOverview: Hereditary Similarity and Variation Living organisms are distinguished by their ability to reproduce their own kind. Offspring resemble their parents more than they do less closely
University of Texas - BIO - 311C
Chapter 14 Mendel and the Gene IdeaLecture OutlineOverview: Drawing from the Deck of Genes Every day we observe heritable variations (such as brown, green, or blue eyes) among individuals in a population. These traits are transmitted from parents t
University of Texas - BIO - 311C
Chapter 16Lecture OutlineThe Molecular Basis of InheritanceOverview: Life's Operating Instructions In April 1953, James Watson and Francis Crick shook the scientific world with an elegant double-helical model for the structure of deoxyribonuclei
University of Texas - BIO - 311C
Chapter 15The Chromosomal Basis of InheritanceLecture OutlineOverview: Locating Genes on Chromosomes Today we know that genes-Gregor Mendel's &quot;hereditary factors&quot;-are located on chromosomes. A century ago, the relationship of genes and chromosom
University of Texas - BIO - 311C
Chapter 17From Gene to ProteinLecture OutlineOverview: The Flow of Genetic Information The information content of DNA is in the form of specific sequences of nucleotides along the DNA strands. The DNA inherited by an organism leads to specific t
University of Texas - BIO - 311C
Chapter 18The Genetics of Viruses and BacteriaLecture OutlineOverview: Microbial Model Systems Viruses and bacteria are the simplest biological systems- microbial models in which scientists find life's fundamental molecular mechanisms in their m
University of Texas - BIO - 311C
Chapter 20DNA Technology and GenomicsLecture OutlineOverview: Understanding and Manipulating Genomes One of the great achievements of modern science has been the sequencing of the human genome, which was largely completed by 2003. Progress began
University of Texas - BIO - 311C
Chapter 19Eukaryotic GenomesLecture OutlineOverview: How Eukaryotic Genomes Work and Evolve Two features of eukaryotic genomes present a major information-processing challenge. First, the typical multicellular eukaryotic genome is much larger th
University of Texas - BIO - 311C
Chapter 21The Genetic Basis of DevelopmentLecture OutlineOverview: From Single Cell to Multicellular Organism The application of genetic analysis and DNA technology to the study of development has brought about a revolution in our understanding
University of Texas - BIO - 311C
Chapter 22 Descent with Modification: Darwinian View of LifeLecture OutlineOverview: Darwin Introduces a Revolutionary Theory On November 24, 1859, Charles Darwin published On the Origin of Species by Means of Natural Selection. Darwin's book dre
University of Texas - BIO - 311C
Chapter 23Lecture OutlineThe Evolution of PopulationsOverview: The Smallest Unit of Evolution One common misconception about evolution is that organisms evolve, in a Darwinian sense, during their lifetimes. Natural selection does act on individ
University of Texas - ECON - 304K
More Cost Charts Economics 304K: Principles of Microeconomics Prof. Meg LedyardA.Q 0 1 2 3 4 5 6 7 8 VC 10 25 45 70 100 135 175 220 FC 3 3 3 3 3 3 3 3 3 TC 3 13 28 48 73 103 138 178 223 AFC 3.00 1.50 1.00 0.75 0.60 0.50 0.43 0.38 AVC 10.00 12.50 15
University of Texas - ECON - 304K
MC answers Fall 06 midterm These are really correct, I am almost positive. 1. A 2. B 3. A 4. C 5. A 6. didn't do this semester 7. A 8. A 9. A 10. D 11. Didn't do this semester
University of Texas - ECON - 304K
Introduction to Microeconomics SyllabusUniversity Of Texas at Austin Economics 304K: Introduction to Microeconomics Unique Number: 34235 SpringProfessor: Meg Ledyard Office: BRB 2.102B Office Phone: 475-8517 E-mail: m.ledyard@eco.utexas.edu Class
University of Texas - ECON - 304K
Answers to MC Eco 304K -TTH Prof. Ledyard1. B or D 2. A 3. D 4. B 5. A 6. A 7. D 8. A 9. A 10. B 11. A
University of Texas - EE - 302
Introduction to Electrical and Computer Engineering (EE302)Fall 2007Course:EE302; Unique #s: 16190, 16195, 16200 Lecture: MWF 9-10AM in ENS 127 Lab: 16190 meets T 11-1 PM in ACA1.108 16195 meets TH 11-1 PM in ACA1.108 16200 meets TH 3-5 PM in ACA
University of Texas - EE - 302
EE 302, Introduction to Electrical and Computer Engineering - Honors Dr. Archie Holmes, Jr. Exam #1Name: _ EID: _Please remember. Read the entire exam before starting If you feel you need more information than is given, please ask! Show all wo
University of Texas - EE - 302
EE 302, Introduction to Electrical and Computer Engineering - Honors Dr. Archie Holmes, Jr. Exam #1Name: _ EID: _Please remember. Read the entire exam before starting All answers must include units and an appropriate number of significant figur
University of Texas - EE - 302
EE 302, Introduction to Electrical and Computer Engineering - Honors Dr. Archie Holmes, Jr. Exam #1Name: _ EID: _Please remember. Read the entire exam before starting All answers must include units and an appropriate number of significant figur
University of Texas - EE - 302
EE 302, Introduction to Electrical and Computer Engineering - Honors Dr. Archie Holmes, Jr. Exam #2Name: _ EID: _Please remember. Read the entire exam before starting If you feel you need more information than is given, please ask! Show all wo
University of Texas - EE - 302
EE 302, Introduction to Electrical and Computer Engineering - Honors Dr. Archie Holmes, Jr. Exam #2 - Fall 2004Name: _ EID: _Please remember. Read the entire exam before starting All answers must include units and an appropriate number of signif
University of Texas - EE - 302
EE 302, Introduction to Electrical and Computer Engineering - Honors Dr. Archie Holmes, Jr. Exam #2Name: _ EID: _Please remember. Read the entire exam before starting All answers must include units and an appropriate number of significant figur
University of Texas - EE - 302
EE 302, Introduction to Electrical and Computer Engineering - Honors Dr. Archie Holmes, Jr. Exam #3Name: _ EID: _Please remember. Read the entire exam before starting If you feel you need more information than is given, please ask! Show all wo
University of Texas - EE - 302
EE 302, Introduction to Electrical and Computer Engineering - Honors Dr. Archie Holmes, Jr. Exam #3Name: _ EID: _Please remember. Read the entire exam before starting All answers must include units and an appropriate number of significant figur
University of Texas - EE - 302
EE 302, Introduction to Electrical and Computer Engineering - Honors Dr. Archie Holmes, Jr. Exam #3 - Fall 2004Name: _ EID: _Please remember. Read the entire exam before starting If you feel you need more information than is given, please ask!
University of Texas - EE - 302
Practice ProblemFind Vo in the circuit.Practice ProblemFind Vx and Vo in the circuit.Practice ProblemFind vo and io in the circuit.Practice ProblemFind the currents and voltages in the circuit.Practice ProblemCalculate Rab.Practice Pro
University of Texas - EE - 302
EE302 Exam2 Review Problems1. Use the node-voltage method to find the power associated with the 2A source.24 2ADC55V3P = 40W2. Find the current Io flowing through the 10 resistor using the current analysis technique that results in the
University of Texas - EE - 302
Exam 2 Practice ProblemsFor Problems 1-21, use the figures at the end of this document. 1. Calculate the power dissipated by each resistor in Figure 1.Resistor 2 10 5 8 3 Power 2.40W 0.100W 5.00W 6.50W 1.30W2. Calculate the power being delivered
University of Texas - EE - 302
EE302 Practice Problems for Exam #31. Use a series of source transformations to find the current Io flowing through the 2 resistor in the circuit below. Mark the direction of the current Io.Io1A2. When a 15k resistor is connected to the termin
University of Texas - EE - 302
EE302 Practice Problems for Exam #31. Use a series of source transformations to find the current Io flowing through the 2 resistor in the circuit below. Mark the direction of the current Io.10A41 40 24A5DC10VIo1A2. When a 15k resi
University of Texas - EE - 302
University of Texas - EE - 302
Node Voltage Review ProblemsSome tips for writing KCL equations Label branch currents in all branches as I1, I2, I3. Mark current directions as going left to right or up to down. Then write KCL for every node in terms of I1, I2, I3., with curren
University of Texas - EE - 302
Practice ProblemsSuperpositionPractice Problem # 1Practice Problem # 2Practice Problem # 3
University of Texas - EE - 302
EE302 A Circuit a Day Club (ACDC)Rules Solve one circuit a day from the list of problems given or from the homework problems. You may not roll over problems from one day to another. Note down the problem number in the spreadsheet given. This is
University of Texas - EE - 302
EE302 Fall '07 HomeworkHW1 HW2 HW3 HW4 HW5 HW6 HW7 HW8 HW9 HW101.6, 1.11, 1.18, 1.20, 1.28, 1.36 2.12, 2.16, 2.17, 2.18, 2.20, 2.22 2.26, 2.32, 2.34, 2.38, 2.41, 2.45 3.6, 3.10, 3.12, 3.17, 3.20, 3.22 3.36, 3.39, 3.40, 3.44, 3.50, 3.52 3.56, 3.60
University of Texas - EE - 302
Chapter 1, Problem 6. The charge entering a certain element is shown in Fig. 1.23. Find the current at: (a) t = 1 ms (b) t = 6 ms (c) t = 10 msChapter 1, Problem 11.A rechargeable flashlight battery is capable of delivering 85 mA for about 12 h. H
University of Texas - EE - 302
EE302 Homework #1 Chapter 1, Problem 6. The charge entering a certain element is shown in Fig. 1.23. Find the current at: (a) t = 1 ms (b) t = 6 ms (c) t = 10 msChapter 1, Solution 6. (a) At t = 1ms, i = (b) At t = 6ms, i =dq 80 = = 40 A dt 2dq
University of Texas - EE - 302
Chapter 1, Problem 6. The charge entering a certain element is shown in Fig. 1.23. Find the current at: (a) t = 1 ms (b) t = 6 ms (c) t = 10 msChapter 1, Problem 11.A rechargeable flashlight battery is capable of delivering 85 mA for about 12 h. H
University of Texas - EE - 302
In the circuit in Fig. 2.76, obtain v1, v2, and v3.Chapter 2, Problem 16.Determine Vo in the circuit in Fig. 2.80.62+ 9V + _ Vo _ + _ 3VObtain v1 through v3 in the circuitFind I and Vab in the circuit.Determine io in the circuitFin
University of Texas - EE - 302
In the circuit in Fig. 2.76, obtain v1, v2, and v3.Chapter 2, Problem 16.Determine Vo in the circuit in Fig. 2.80.62+9V+ _Vo+ _3V_Obtain v1 through v3 in the circuitFind I and Vab in the circuit.Determine io in the circ
University of Texas - EE - 302
Chapter 2, Problem 26. For the circuit in Fig. 2.90, io =2 A. Calculate ix and the total power dissipated by the circuit.ixio 2 4 8 16The voltage across the 8 resistor is that across the 16.A. TrueB. FalseChapter 2, Problem 32. Find i1 thr
University of Texas - EE - 302
Chapter 2, Problem 26. For the circuit in Fig. 2.90, io =2 A. Calculate ix and the total power dissipated by the circuit.ixio 2 4 8 16The voltage across the 8 resistor is that across the 16.A. TrueB. FalseChapter 2, Problem 32. Find i1 thr
University of Texas - EE - 302
Chapter 3, Problem 6. Use nodal analysis to obtain v0 in the circuit in Fig. 3.55. The current I1 is equal toA. V0/4B. 3AC. (V0 -12)/4D. None of the aboveChapter 3, Problem 10. Find i0 in the circuit in Fig. 3.59.The supernode method needs
University of Texas - EE - 302
Chapter 3, Problem 36. Rework Prob. 3.6 using mesh analysis.Chapter 3, Problem 39. Determine the mesh currents i1 and i2 in the circuit shown in Fig. 3.85.Chapter 3, Problem 40. For the bridge network in Fig. 3.86, find Io using mesh analysis.C
University of Texas - EE - 302
Chapter 3, Problem 56. Determine v1 and v2 in the circuit of Fig. 3.101.The voltages across all the resistors will be the same because the values of the resistors are the same. A. True B. FalseChapter 3, Problem 60. Calculate the power dissipated
University of Texas - EE - 302
Chapter 4, Problem 24.Use source transformation to find the voltage Vx in the circuit of Fig. 4.92.3A8 + + _ Vx 1040 V102 VxChapter 4, Problem 26.Use source transformation to find io in the circuit of Fig. 4.94.53Aio46A2
University of Texas - EE - 302
Chapter 4, Problem 40. Find the Thevenin equivalent at terminals a-b of the circuit in Fig. 4.107.+ Vo 20 k10 k a70 V + _ b+ 4 VoChapter 4, Problem 43. Find the Thevenin equivalent looking into terminals a-b of the circuit in Fig. 4.11
University of Texas - EE - 302
Chapter 5, Problem 8. Obtain vo for each of the op amp circuits in Fig. 5.47.Figure 5.47 for Prob. 5.8Chapter 5, Problem 10. Find the gain vo/vs of the circuit in Fig. 5.49.Figure 5.49 for Prob. 5.10Chapter 5, Problem 13. Find vo and io in th
University of Texas - EE - 302
EE302 Homework #1 Chapter 1, Problem 6. The charge entering a certain element is shown in Fig. 1.23. Find the current at: (a) t = 1 ms (b) t = 6 ms (c) t = 10 msChapter 1, Solution 6. (a) At t = 1ms, i = (b) At t = 6ms, i =dq 80 = = 40 A dt 2dq
University of Texas - EE - 302
EE302 Homework #2 Chapter 2, Problem 12. In the circuit in Fig. 2.76, obtain v1, v2, and v3.Chapter 2, Solution 12. + 15v -loop 2 25v + + 20v For loop 1, For loop 2, For loop 3, + 10v + v1 + v2 + v3 -loop 1loop 3-20 -25 +10 + v1 = 0 -10 +1
University of Texas - EE - 302
EE302 Homework #3 Chapter 2, Problem 26. For the circuit in Fig. 2.90, io =2 A. Calculate ix and the total power dissipated by the circuit.ix io 2 4 8 16 Chapter 2, Solution 26. If i16= io = 2A, then v = 16x2 = 32 Vi8 =v =4A, 8i4 =v = 8 A
University of Texas - EE - 302
EE302 Homework #4 Chapter 3, Solution 6. i1 + i2 + i3 = 0v0 - 12 v0 v0 - 10 + + =0 4 6 2or v0 = 8.727 VChapter 3, Solution 10.At node 1:V - V3 V1 +4+ 1 = 0, 8 1also by Ohm's law: I 0 =V1 8 V1 V3 V3 - V1 + + =0 4 4 1At node 3: - 2 I 0 +
University of Texas - EE - 302
EE302 Homework #5 Chapter 3, Solution 36.4 i1 i2 10 V + i312 V+I16I22Applying mesh analysis gives, 12 = 10I1 6I2 -10 = -6I1 + 8I2or 6 5 - 3 I 1 - 5 = - 3 4 I 2 =5 -3 6 -3 5 6 = 11, 1 = = 9, 2 = = -7 -3 4 -5 4 -
University of Texas - EE - 302
EE302 Homework #6 Chapter 3, Solution 56. + v1 2 2i222 2+v212 V+i1i3For loop 1, 12 = 4i1 2i2 2i3 which leads to 6 = 2i1 i2 i3 For loop 2, 0 = 6i2 2i1 2 i3 which leads to 0 = -i1 + 3i2 i3 For loop 3, 0 = 6i3 2i1 2i2 whic