Free Essay

Electrical Engineering

In:

Submitted By konglee21
Words 1021
Pages 5
COMP122
Week 1 Homework

Part 1: Complete the following problems.

1. What is machine code? Why is it preferable to write programs in a high level language such as C++? A machine code is consisting of a low level programming language that is executed by CPU. Writing a program in C++, a computer translate the C++ code in the machine code for the CPU to understand.

2. What does a compiler do? What kinds of errors are reported by a compiler?

Compiler help translate high level programming language into machine code. That will report any syntax, type errors, and declaration errors.

3. What does the linker do?

The linker takes in object of a library file which combines them into an module or load module. It can also converts object files into executable files.

4. What is an algorithm?

An algorithm is a set of instructions to follow when writing any kind of programs.

5. Bob enters a pizza shop and notices there are three different sizes of pizzas available. Sizes are given as the diameter of the pizza in inches. The cost of a pizza is based on the size. Bob would like to know which size of pizza has the lowest cost per square inch.

a. Identify the inputs and outputs for this problem.

The inputs are the diameter of each pizza and cost.
The outputs are the prompt for the users to determine the diameter and cost of each pizza which he will finished the cost of per square inch.

b. Identify the processing needed to convert the inputs to the outputs. Enter the diameter of the pizza which area of circle = (Pi(r )^2) / cost of pizza = cost per square inch

c. Design an algorithm in pseudocode to solve this problem. Make sure to include steps to get each input and generate each output. //Constants Area= Pi (r)^2

//Variables Diameter Cost

//Output “Please enter the diameter of the pizza.” “Please enter the cost of the pizza.”

//Calculation Diameter / 2=r Area/cost

//Output “The cost per square inch of your pizza is.”

Part 2: Complete the following problems.

1. Given the following expressions, what value would they have in a C++ program? a. 13 / 4 =3 b. 2 + 12 / 4=5 c. 21 % 5=1 d. 3 - 5 % 7=1 e. 17.0 / 4=4 f. 8 - 5 * 2.0=-2 g. 14 + 5 % 2 – 3=12 h. 15.0 + 3.0 / 2.0=16

2. Given the following variable declarations:

int num1 = 10, num2 = 20, newNum = 30; double x = 5.0, y = 8.0;

Determine which of the following assignment statements are valid. For each invalid statement, explain why it is invalid. Assume that each statement immediately follows the above variable declarations.

a. num1 = 15; invalid, num 1 = 10 b. num2 = num1 - 18; invalid, num 1 = 10 and num 2 = 20 c. num1 = 5; num2 = 2 + 6; num1 = num2 / 3; invalid, num 1 =10, num 2 = 20 d. num1 + num2 = newNum; valid e. x = 12 * num1 - 15.3; invlaid, x=5.0 f. num1 * 2 = newNum; invlaid, newNum=30
g. x / y = x * y; nvalid, dividing and mulltipling the same number do not give the same result h. num2 = num1 % 2.0; invalid, num2=20 i. newNum = static_cast<int> (x) % 5; invalid, newNum=30 j. x = x + 5; invalid, x=5 k. newNum = num1 + static_cast<int> (4.6 / 2); ; invalid, newNum=30

3. For each of the following lines of variable declarations, identify it as valid or describe what makes the line invalid.

Line 1:n = 12; invalid, the data type is not specified
Line 2: char letter = ; invalid, the variable has no value or remove the =
Line 3: int one = 5, two valid
Line 4: double x, y, z; valid

4. Write C++ statements that accomplish each of the following:

a. Declare and initialize int variables x to 25 and y to 18. int x= 25 int y= 18 b. Declare and initialize an int variable temp to 10 and a char variable ch to 'A'.
Int temp= 10
Char ch= A c. Add 5 to the int variable x which already exists. x+5 d. Declare and initialize a double variable payRate to 12.50.
Double pay rate = 12.50 e. Copy the value from an existing int variable firstNum into an existing int variable tempNum. tempNum + first Num f. Swap the contents of existing int variables x and y. (Declare any new variables you need.)
Int x = 1
Int y = 2 g. Output the contents of existing double variables x and y, and also output the value of the expression x + 12 / y - 8.

cout << “ x = “ << x; cout << “ y = “ << y; cout << “ x + 12 / y – 8 = “ << x + 12 / y – 8 << endl;

h. Copy the value of an existing double variable z into an existing int variable x.

5. Given the following variable declarations:

int x = 2, y = 5, z = 6;

What is the output from each of the following statements?

a. cout << "x = " << x << ", y = " << y << ", z = " << z << endl; x = 2, y =5, z = 6 b. cout << "x + y = " << x + y << endl; x + y = 7 c. cout << "Sum of " << x << " and " << z << " is " << x + z << endl;
Sum of 2 and 6 is 8 d. cout << "z / x = " << z / x << endl; z / x = 3 e. cout << "2 times " << x << " = " << 2 * x << endl;
2 times 2 = 4

6. Given the following variable declarations:

int a = 5, b = 6, c;

What is the value of a, b, and c after each of the following statements executes? Assume that the statements execute in the sequence given.

a. a = b++ + 3; 6+3 b. c = 2 * a + ++b; c = 17 c. b = 2 * ++c - a++; 6 = 2 * c + 1- 5

Similar Documents

Premium Essay

Electrical Engineering

...COVER PAGE Electrical and computer Engineering University of West Florida Course: EGN 43032 Summer Fall 2013 Maximum Credit: 10 points I, the undersigned, wrote the attached report. Student Signature: ________________________________ Date: __________________ Student Name: __________________________________________ Instructions; View the movie on Henry’s Daughters in the e-learning under Content. After the viewing movie, prepare a written response to the questions below. (Length: 3 to 4 pages without the cover page; 1.5 space; 12 point type; 1 inch margins) _________________________________________________________________________________________ 1. List the ethical issues you observed in Henry’s Daughters. 2. From your personal perspective, prioritize these ethical issues from most critical to least critical 3. Discuss the movie from three other perspectives: a) Henry’s Perspective: Assume you are Henry. i. What specific ethical issues do you face? Describe. ii. What are some things that you should consider? Describe. iii. From whom or where should you seek guidance? Describe. b) Laura’s Perspective: Assume you are Laura. i. What specific ethical issues do you face? Describe. ii. What decisions would you change if you were Laura? Describe. iii. From whom or where could you seek guidance? Describe. b) Julie’s Perspective: Assume you are Julie. i. What specific ethical issues do you face? Describe. ii. What decisions would you...

Words: 325 - Pages: 2

Premium Essay

Information Technology in Electrical Engineering

...INFORMATION TECHNOLOGY IN ELECTRICAL ENGINEERING Electrical engineering is one of the newer branches of engineering, and dates back to the late 19th century. It is the branch of engineering that deals with the technology of electricity. Electrical engineers work on a wide range of components, devices and systems, from tiny microchips to huge power station generators. Electrical engineering has now subdivided into a wide range of subfields including electronics, digital computers, power engineering, telecommunications, control systems, radio-frequency engineering, signal processing, instrumentation, and microelectronics. Early experiments with electricity included primitive batteries and static charges. It has been a subject of scientific interest since at least the early 17th century. The first electrical engineer was probably William Gilbert who designed the versorium: a device that detected the presence of statically charged objects. He was also the first to draw a clear distinction between magnetism and static electricity and is credited with establishing the term electricity. In 1775 Alessandro Volta's scientific experimentations devised the electrophorus, a device that produced a static electric charge, and by 1800 Volta developed the voltaic pile, a forerunner of the electric battery. However, the actual design, construction and manufacturing of useful devices and systems began with the implementation of Michael Faraday’s Law of Induction, which essentially states that...

Words: 689 - Pages: 3

Premium Essay

Safety Awareness in Electrical Engineering

...Safety Awareness in Electrical Engineering It is important for students studying to become electrical engineers to be aware of electrical safety measures and hazards. There are several severe, even life-threatening hazards that one could encounter when among electrical equipment. Two main dangers related to dealing with electrical equipment shocks and burns are overloading outlets with too many devices, and neglecting to implement the usage of a Ground-Fault Circuit Interrupter. While outlets are designed to handle multiple plugs, it is crucial to know that they do have limitations as far as what they are capable of supporting. Various dangers can occur by overloading an outlet. Risks of electrical fires are increased when two or more appliances are plugged in at once, or when extra electricity is required by means of an extension cord. This is also the reason why major appliances such as refrigerators and dryers should be plugged directly into their own outlet; they are heavy power users. Although most homes and appliances have fuses as a form of safety to prevent fires, people should still be aware of the amount of power can be placed on each outlet or circuit. A safety procedure that could potentially be life-saving is the usage of a ground-fault circuit interrupter (GFCI). It protects people from electrical shocks by monitoring the amount of current flowing in a circuit (from hot to neutral), and thereby locating a loss of current. If it senses an imbalance, the...

Words: 395 - Pages: 2

Premium Essay

A Career In Electrical Engineering

...desire to aggrandize my knowledge and a technology enthusiast in me, motivated me to pursue Ph.D. in Electrical and Computer Engineering. I believe that my previous education has inculcated qualities that are necessary to meet the diligence and also the tenacity required to meet the needs of this program. I possess a strong fundamental knowledge in Electrical Engineering, a desire to learn, a predilection for teamwork and leadership, and enthusiastic enjoyment in challenges. My ultimate goal is to complete my doctorate so that I can disseminate knowledge and make a contribution to the improvement of electrical education. Over the past few years, my journey towards this goal is at its best. It was time for me to take one of the biggest decisions...

Words: 986 - Pages: 4

Premium Essay

Summary Of Purpose In Electrical Engineering

...I am ABHINAY DOMALA ,an undergraduate student in Electronics and Communications Engineering from St.MARTIN'S ENGINEERING COLLEGE affiliated to JNTUH, have applied to graduate program in Electrical Engineering at your University. In the following lines I attempt to give a brief portrayal of my interests, aptitude, education and extra curricular activities. The process of learning continues throughout once life says an old adage. As one goes on learning new things, one realizes that there are many more things which one needs to learn to quench one’s thirst for knowledge. During the course of my undergraduate study I have learnt many things but I have also realized that I need to learn more to advance frontiers in my field of interest. A graduate...

Words: 856 - Pages: 4

Premium Essay

Electrical Engineering Research Paper

...Statement of Purpose I am applying to pursue my Doctor of Philosophy degree in Electrical Engineering. My research interest is in the signal, image and video processing, VLSI and embedded systems and biomedical sensor. My career goal is to pursue my career as a researcher, either as a teaching faculty or in an R & D department of an industry. With the enthusiasm and the predilection to science, I started my bachelor’s degree in Electrical and Electronic Engineering. In my childhood, my father used to help me to study mathematics and science, the way he used to explain the scientific terms of my textbooks, enthralled me, created an inclination to do something by myself. How by using...

Words: 1021 - Pages: 5

Premium Essay

Electrical Engineering Personal Statement

...As the one having a bright record throughout the student life. I wanted to opt for technically challenging and fulfilling career. The excitement of setting a goal and solving it by new scientific techniques and innovations with a single-minded devotion has fascinated me ever since and has led me to choose engineering as my fission. And now I feel that I will justice to both myself and to the quality of undergraduate education being offered to me by pursuing graduate studies and delving into further research. I take this opportunity to describe my educational background and career objectives, which have motivated me to pursue research career in Electrical Engineering. My first contact with electrical engineering was in high school when I took an elective course for the same. It was the time when technology had begun to make an impact on the lives of people in India. The design projects that I had taken kept my interest in the field of electronic circuit design and I developed a strong liking for the subject. My interest grew strong enough for my...

Words: 1490 - Pages: 6

Free Essay

Example Essay on Electrical Engineering

...Choosing a particular field of engineering can often be very difficult for the undergraduate engineering student. A field particularly interesting to me is the development of network devices and the transmission of information between networks. Whether it is designing faster and more efficient modem circuits or researching for better transmission of signals between Earth and satellites, this field would be both challenging and exciting. The Internet is one of the best examples of how this field has impacted society. Enormous amounts of information are now accessible to anyone, anywhere. From network interface card design to on-demand Internet processing, I believe the world of networking has endless opportunities for engineers to get involved and make it better. Networking technology has become a necessity for affairs in government agencies, international corporations, banks, and the life of common citizens. This field has exploded over the last ten years. The need for better servers, faster signal transmission such as in fiber-optics, and secure online commerce are only a few examples which lead to various engineering opportunities. I think the impacts of this career would directly affect society, and its advances have already influenced the way we live our lives. People are electronically withdrawing and transferring money in their accounts, balancing their checkbooks online, shopping for groceries, and even ordering pizzas! Companies have cut costs on paper usage while helping...

Words: 568 - Pages: 3

Free Essay

Electrical Engineering

...A Pragmatic Introduction to the Art of Electrical Engineering Paul H. Dietz Version 1.0 - ©1998 Paul Henry Dietz - All rights reserved. A Pragmatic Introduction to the Art of Electrical Engineering i L ICENSE Rights and Obligations vii How it Works vii A Disclaimer viii C REDITS How Did We Get Here? ix A Book is Born ix And I Want to Thank All the Little People... x P ROLOGUE Electrical Engineering for Fun and Profit xi Cold Sandwiches, again? xi Electrical Engineering as Programming and Interfacing xii The Basic Stamp 2 xiii About This Book xiv C HAPTER 1 Getting Started with the BASIC Stamp 21 The Problem 1 What You Need to Know 1 What is a BASIC Stamp 2? 2 How Do I Wire it Up? 2 How Do I Get to the Software? 5 A First Example Program 5 A Second Example Program 6 ii A Pragmatic Introduction to the Art of Electrical Engineering C HAPTER 2 Lights and Switches 8 The Problem 8 What You Need to Know 8 What is Voltage? 9 What is Current? 10 What is an LED? 12 How Do I Interface a Switch? 16 What is a Seven Segment Display? 18 Where Do We Go Next? 20 C HAPTER 3 Maybe 21 The Problem 21 What You Need to Know 22 What is a Voltage Divider? 22 How Do I Solve More Complex Resistive Circuits? 24 Are There Any Tricks That Can Make This Easier? 27 What is an Independent Source and What is Superposition? 30 What is a Digital to Analog Convertor? 32 What’s Next? 33 C HAPTER 4 Guess the Number 34 The...

Words: 37923 - Pages: 152

Free Essay

The First I Have to Do Is to Finish This School. After It There I Would Like to Study the University of Economics or Faculty of Electrical Engineering at the Czech Technical University. Rather I Would Like to Study the

...The first I have to do is to finish this school. After it there I would like to study The University of Economics or Faculty of Electrical Engineering at the Czech Technical University. Rather I would like to study the University of Economics, because after finishing it I would have two qualifications, computer specialist and engineer of economy. The second school is very good too, because I would have a complex overview in computers. During the studies I would like to join some exchange program for students and study few months abroad. It would be absolutely perfect, because of get some experience with foreign circumstances. Next aim I would like to achieve is to learn fluently French and German. It’s necessary, because we are surrounded by German speaking countries and the official language in the European Union is the French. My school selection has another advantage. After reach some experience skills in the computer world I could certify my knowledge by Microsoft certificating program. The test and certificate are world reputable, which could be very useful in the future job. During the studies, there is a possibility to work for a company connected with school, where I could get some experience as a practice. If I found some good practice during my studies I would try to lunch out on my own. I would try to find a flat and live my own life. I have to prove to everybody, especially to my family, that I am able to see after myself. After the school I would like to find...

Words: 587 - Pages: 3

Free Essay

Electrical Engineering 243

...May  8,  2012     [JOSEPH  |  OLADOTUN  |ANISE]   EEGR243: Computer Architecture Clarence M. Mitchell, Jr. School of Engineering Morgan State University Instructor: Dr. Walker Project #2 Date Due: March 07, 2011 Team member Oladotun Opasina Richard Joseph Anise Udiani. EEGR243  Project#2   1     May  8,  2012     [JOSEPH  |  OLADOTUN  |ANISE]   Table of Contents Introduction …………………................................................................................ Requirements Schematics ...................................................................................................................... ................................................................................................................................... .............................................................................................. Discussion/Analysis/Conclusion EEGR243  Project#2   2     May  8,  2012     [JOSEPH  |  OLADOTUN  |ANISE]   Introduction: Vhdl is also known as Very High level Speed Integrated Circuit hardware description language it is used for electronic design automation to depict digital and mixed signal systems .The US Department of Defense first developed this to document the behavior of the ASCIS that companies that supplied them with components were including in there equipment. The reason this was ideal was that it provided...

Words: 648 - Pages: 3

Free Essay

Mr. Tucker

...“Electrical Engineer” My field of study is Electrical Engineer. New technology in my field: The field first became an identifiable occupation in the late nineteenth century with the commercialization of the electric telegraph and electrical power supply. Definition of electrical engineering. : A branch of engineering that deals with the practical application of electricity especially as related to communications, the distribution of power, and the design and operation of machinery and equipment. Early experiments with electricity included primitive batteries and static charges. However, the actual design, construction and manufacturing of useful devices and systems began with the implementation of Michael Faraday's Law of Induction, which essentially states that the voltage in a circuit is proportional to the rate of change in the magnetic field through the circuit. This law applies to the basic principles of the electric generator, the electric motor and the transformer. The advent of the modern age is marked by the introduction of electricity to homes, businesses and industry, all of which were made possible by electrical engineers. Some of the most prominent pioneers in electrical engineering include Thomas Edison (electric light bulb), George Westinghouse (alternating current), Nikola Tesla (induction motor), Guglielmo Marconi (radio) and Philo T. Farnsworth (television). These innovators turned ideas and concepts about electricity into practical devices and systems...

Words: 344 - Pages: 2

Premium Essay

Gate

...below for details on the Application date and avail the complete details by clicking the link provided for each of the respective PSU.   Eligibility Criteria: * Candidates applying to the PSUs Recruiting through GATE 2015 must have applied and appeared for GATE 2015 exam in their respective branch of study. * They must furnish the GATE 2015 Registration No while Applying for the PSU Recruitment through GATE 2015   Details of PSU Recruitment through GATE 2015 are as follows:  Name of PSU | Application Dates | Eligible Branches | ONGC Ltd. | Start of online application January 2015 and Last date for submission of application: January, 2015 | Engineering  and Geo Physics | Coal India Ltd | Start of online application December 2014 andLast date for submission of application: December, 2014 | Mechanical, Electrical, Mining and Geology | CEL | Start of Online Application Form: December 18, 2014 and Last Date for submission of...

Words: 663 - Pages: 3

Premium Essay

Syllabus

...larger community, producing competent and principled professionals who will contribute significantly to the betterment of society. DEPARTMENT MISSION STATEMENT The Electrical and Electronics Engineering (EEE) Department commits itself to provide students with industry-grade and outcomes-based education in electrical, electronics and communications engineering that will allow the students to develop a greater sense of professional responsibility, social awareness and high competitiveness in industry or in graduate work. DEPARTMENT VISION STATEMENT The Electrical and Electronics Engineering (EEE) Department envisions itself as a center of excellence, leadership, and an internationally recognized institution in electrical and electronics engineering education and technology. Section 2 PROGRAM OUTCOMES a. ability to apply knowledge of mathematics and science to solve engineering problems b. ability to design and conduct experiments, as well as to analyze and interpret data c. ability to design a system, component, or process to meet desired needs within realistic constraints such as economic, environmental, social, political, ethical, health and safety, manufacturability, and sustainability, in accordance with standards d. ability to function on multidisciplinary teams e. ability to identify, formulate, and solve engineering problems f. understanding of professional and ethical responsibility g. ability to communicate effectively h. broad education necessary to understand the impact...

Words: 1551 - Pages: 7

Premium Essay

Read Only Participant

...kahuroallan@gmail.com I am a talented, enthusiastic, self-motivated and passionate Telecommunication and Information Engineering student knowledgeable in; operation of electrical devices and machines, making domestic wiring connections, computer programming using programming languages like C, Java and MATLAB, troubleshooting software and hardware computer complications as well as computer program installations. Personal Details * Date of Birth: August 22nd, 1991. * Marital Status: Single Education & Professional Qualifications: * Bachelor of Science Telecommunication and Information Engineering, May 2011 to Date * Kenya Certificate of Secondary Education, Kagumo High School , 2006-2009  * Kenya Certificate of Primary Education, Githunguri Township Primary School, 1997-2005 Key Skills & Competencies: * Outstanding knowledge of governmental Information Technology and Electricity generating schemes. * Good relationship management with other members of staff and colleagues. * Ability to achieve strong grasp of operations of various departments within the organization in a short time * Strong and excellent written and verbal communication skills. * Ability to maintain composure and sense of humor in the face of heavy workload and a tight schedule. PROFESSIONAL EXPERIENCE Intern- I.T and Electrical Engineering: Farmer’s Choice Limited (Feb. to May) 2014. Duties and Responsibilities: * Performed complex computer operation...

Words: 418 - Pages: 2