This document contains instructions and questions for an exam on computer programming. It includes 10 multiple choice questions testing theoretical knowledge of C++ concepts like data types, selection structures, and functions. There are also questions requiring students to write C++ code, such as calculating mathematical expressions, using loops and arrays, and creating a program to calculate seminar registration costs based on number of attendees. Students are instructed to answer all questions, show working where needed, and submit their responses online.
A pointer is a variable that is used to store a memory address.
The reference operator is used to access the memory address of a variable and store it in a pointer.
C programming 28 program
More information Follow YouTube & Facebook
https://www.youtube.com/channel/UC9lsTSoLqIEC85MU9tqFqOA/playlists
https://www.facebook.com/fcoursesbd
A few Programs, that are tested with compilers of respective IDEs s Bloodshed-DevC++, Visual Studio 2008, Qt 4.2. These are running successfully within console window of windows platform. So just enjoy coding. Programs in C of College days.
A pointer is a variable that is used to store a memory address.
The reference operator is used to access the memory address of a variable and store it in a pointer.
C programming 28 program
More information Follow YouTube & Facebook
https://www.youtube.com/channel/UC9lsTSoLqIEC85MU9tqFqOA/playlists
https://www.facebook.com/fcoursesbd
A few Programs, that are tested with compilers of respective IDEs s Bloodshed-DevC++, Visual Studio 2008, Qt 4.2. These are running successfully within console window of windows platform. So just enjoy coding. Programs in C of College days.
By Analyzing and Utilizing Jean Watson theory of caring, creatTawnaDelatorrejs
By Analyzing and Utilizing Jean Watson theory of caring, create 6-7 slides PowerPoints including your sources on Improvement in two nursing areas:
· Nursing research
· Health disparities
Your sources should be within the last 5 years. Only 2 sources
Name_______________________________
Overview:The connect question requires creation of posted transactions common to manufacturing companies to inventory T-accounts. This assignment builds on these transactions with additional detail relating to the application and incurrence of overhead. Students will complete journal entries and common reports relating to the activity through the cost accounts, including clearing any over- or under-applied overhead. Budgeted/estimated, applied and actual overhead will be examined using multiple application methods including traditional predetermined rates and activity-based costing. Various methods of overhead application will be compared in totality as well as more specifically at a job level basis. Students also will explore the impact of overhead costing in the bidding process typical of companies using job costing.
Use “given” and your “results” from HW 2.1 Question 15 on CONNECT relating to Lock-Tite Company to complete the Project requirements below. Make sure you are using CORRECT answers from connect.
1) Write journal entries in good format for Lock-Tite Company for the following transactions for the period as calculated/given in the problem on CONNECT.
Ref.
Account
Debit
Credit
a) Raw Material purchased on account
a
b) Raw Material used as direct and indirect material
b
c) Recognition of direct and indirect labor owed to employees
c
d) Application of factory overhead to work-in-process
d
e) Recognition of Cost of Goods Manufactured
e
f) Recognition of Sales Revenue
f
g) Recognition of Cost of Goods Sold
g
h) Incurrence of other overhead costs (use “various” to represent multiple accounts.
h
2) Adjusting Factory Overhead: Use these T-accounts to complete the requirements below:
COGS
Unadjusted Balance from connect
AJE
Adjusted COGS balances
Factory Overhead
Unadjusted Balance
AJE
Adjusted COGS balances
a) Include the unadjusted balances in the T accounts above. The COGS unadjusted balance can be found in the partial income statement underneath the T accounts on Question 11 of connect HW2.1 assignment. The unadjusted Factory Overhead balance is the last row of the Factory Overhead T account again in Question 15 of connect HW2.1 assignment.
b) Assume Lock-Tite clears all its under- or over-applied overhead to cost of goods sold. Write the “adjusting” journal entry to zero the Factory Overhead account.
c) Post the journal entry to the COGS and FOH T accounts above 2a and calculate the “adjusted balances for ...
1 University of Leeds School of Computing Proced.docxjeremylockett77
1
University of Leeds School of Computing
Procedural Programming COMP1711
Semester 1, 2019-2020
Coursework 1
40 Marks
(20% of the total module marks)
Submission Deadline
Your coursework must be uploaded to Minerva before
10am on Friday 25/10/2019
Late Penalties
5% will be deducted from your overall mark for every late day
1 Skills Tested
This coursework will test your ability to write a C program that correctly uses variables, expressions,
assignment, conditional execution (the ‘if’ statement), and iteration (the ‘while’ or ‘for’ loops). It will
also test your ability to write well-structured C programs with correct indentation of statements.
Finally, you need to show that you are able to use comments to explain how your program works.
2 The Brief
You will write a program for an energy provider company. The program computes and prints quarterly
electricity bills for different customers. It also computes and prints the quarterly profit of the
company.
3 The Details
An energy provider company needs a program to compute and print electricity bills. The program
takes as input the quarterly electricity consumption of a customer in kilowatt-hours (kWh) then
computes and prints the bill on the screen.
The company supplies electricity to two types of customers:
1. Domestic customers.
2. Business customers.
The tariff (price/unit energy) that the company charges for electricity:
• £0.65/kWh for domestic customers.
• £1.04/kWh for business customers.
Business customers are given a 10% discount on the cost of consumed electricity if their quarterly
2
consumption is above 5000 kWh.
In addition to the cost of consumed electricity, customers must also pay a standing charge to cover
transmission and operational costs. The standing charge is:
• £0.30/day for domestic customers.
• £0.96/day for business customers.
For simplicity, we will assume that a quarter has exactly 91 days.
Customers must also pay VAT (Value Added Tax) on the total amount of charges. The current VAT
rates are:
• 5% for domestic customers.
• 20% for business customers.
However, if the quarterly consumption of a business customer is less than 1000kWh, they pay a
reduced VAT at 5%.
Finally, business customers must also pay a Climate Change Levy (CLL) at £0.00847/kWh.
3.1 Examples
Here are some examples of how to compute bills for both types of customers.
Example 1. A domestic customer consumed 300kWh in one quarter:
Electricity cost 300 * 0.65 = £195.00
Standing charge (91 days) 91 * 0.30 = £27.30
Total charges 195.00 + 27.3 = £222.30
VAT at 5% (on £222.30) 222.30 * 0.05 = £11.115
Amount due (rounded to nearest penny) £233.42
Example 2. A domestic customer consumed 0kWh in one quarter:
Electricity cost 0 * 0.65 = £0.00
Standing charge (91 days) 91 * 0.30 = £27.30
Total charges 0.00 + 27.3 = £27.30
VAT at 5% (on £27.30) 27.3 ...
Spring 2014 CSCI 111 Final exam of 1 61. (2 points) Fl.docxrafbolet0
Spring 2014 CSCI 111 Final exam � of �1 6
1. (2 points) Flip over this test. On the back of this test write your name in the upper, left-hand
corner.
2. (2 points) What are the four parts of the compiling process (just give me 4 words, not a
paragraph).
3. (4 points) Which of the four steps of the compiling process occurs only once, regardless of
the number of source files your application has?
4. (4 points) Write a line of code that causes the preprocessor to generate an error.
5. (4 points) Write a line of code that causes the compiler to generate an error.
6. (5 points) Describe how you could incorrectly compile the joust project to cause the linker to
generate an error.
7. (5 points) Given:
1 float* fp;
2 //...
3 float pi;
4 pi=*(314 + fp);
Rewrite line 4 using array subscript notation.
Spring 2014 CSCI 111 Final exam � of �2 6
8. (5 points) Given:
1 float arr[100];
2 for(int x=0; x<100; ++x)
3 arr[x]=100-x;
What does the following expression print out?
cout << *arr << endl;
9. (14 points) Given:
int a=0;
int b=6;
int x=0;
Circle each if-expression that evaluates to true:
A) if(b)
B) if(x)
C) if(a=b==6)
D) if(a=b==5)
E) if(a=b=5)
F) if(a=x=0)
G) if(a=x==0)
Spring 2014 CSCI 111 Final exam � of �3 6
10. (10 points) Given:
1 #include<iostream>
2 using namespace std;
3
4 int main()
5 {
6 int x;
7 cout << "Enter a number greater than 10" << endl;
8 while ( x < 10 )
9 {
10 cin >> x;
11 }
12 return 0;
13 }
This program compiles just fine, and sometimes it runs as expected. But sometimes when you
run it, it exits immediately after printing "Enter a number greater than 10". That is, the program
doesn't pause for you to enter a number. Why are you getting this inconsistent behavior?
11. (4 points) What is the output of the following:
int x=4;
int y=3;
A) cout << x / y << endl;
B) cout << x % y << endl;
C) cout << x << "%" << y << endl;
D) cout << "x" << '%' << 'y' << endl;
Spring 2014 CSCI 111 Final exam � of �4 6
12. (16 points) What is the type of the expression. That is, what is the kind of thing that each
expression evaluates to. For example:
3 + 4 integer
You may assume that the variable a has been declared as an integer.
A. a + 4
B. a = 4
C. 3.14 + 4.49
D. 3 + 3.14
E. 'a'
F. cout << a
G. new float[30]
H. new float
Spring 2014 CSCI 111 Final exam � of �5 6
13. (5 points) Write a for-loop that prints out the numbers between 1 and 100 that are evenly
divisible by three.
14. (5 points) Write a while-loop that prints out the numbers between 1 and 100 that are evenly
divisible by three.
15. (5 points) Write a do-while-loop that prints out the numbers between 1 and 100 that are
evenly divisible by three.
Spring 2014 CSCI 111 Final exam � of �6 6
16. (10 points) Given:
1 #include<iostream>
2
3 class Willow {
4 publi.
1-Base-CaseTool KitChapter 11112118Note Calculations are automaMartineMccracken314
1-Base-CaseTool KitChapter 1111/21/18Note: Calculations are automatic, including for tables. This will make the calculations take longer to complete. You can disable automatic calculations for tables by following the steps shown here.Cash Flow Estimation and Risk AnalysisWorksheet 1-Base-CaseThis worksheet contains the base-case model. It calculates an expansion project's cash flows and performance measures using base-case, or most likely, values for the input variables. It also includes the basic analysis but with straight-line depreciation and bonus depreciation.Go to the menu "Files" at the top left of the menu bar.Select "Options" from the items in the first column.This will give you the screen shown below:The second worksheet (2-Sens) extends the basic model to include sensitivity analysis using Data Tables (we include a brief tutorial on the use of Data Tables). Worksheet 2-Sens also illustrates special cases of sensitivity analysis, including breakeven analysis, one-way data tables with multiple outputs, and two-way data tables.Worksheet 3a-Sens extends the basic model to include scenario analysis. Worksheet 3b-ScenMgr shows how to use Excel's Scenario Manager for scenario analysis.Worksheet 4-Sim extends the basic model to include simulation analysis. Worksheet 5-Replmt illustrates the analysis for a proposed cost-reducing replacement investment. Replacement decisions differ from expansion decisions because most of the cash flows are found by subtracting the old project's cash flows from those of the new project to calculate incremental cash flows for use in the analysis.Worksheet 6-DecTree extends the scenario analysis to examine two decision trees in which the decision is made in stages. The first one simply shows the situation where the firm can abandon the project if things are not working out and cash flows are negative. The second one involves a marketing study and a prototype of the final product designed to learn more about demand before deciding to go into full production.Worksheet Appendix 11-A provides depreciation tables as described in Appendix A of the textbook. It also shows examples using straight-line depreciation and bonus depreciation.11-1 Identifying Relevant Cash FlowsA proposal’s relevant project cash flows are the differences between the cash flows the firm will have if it implements the project versus the cash flows it will have if it rejects the project. These are called incremental cash flows.Choose "Formulas" in the first column.11-2 Analysis of an Expansion ProjectThis will give you the screen shown below.The figure below shows the inputs and key results of Project L (one of the projects whose cash flows are used in the previous chapter); the actual analysis is conducted further below in the worksheet. The values in the Inputs section are linked to the model, as are the values shown in Key Results. If you change any of the values in the Input Section, the model recalculate almost instantly, causing ch ...
1-Base-CaseTool KitChapter 11112118Note Calculations are automaAbbyWhyte974
1-Base-CaseTool KitChapter 1111/21/18Note: Calculations are automatic, including for tables. This will make the calculations take longer to complete. You can disable automatic calculations for tables by following the steps shown here.Cash Flow Estimation and Risk AnalysisWorksheet 1-Base-CaseThis worksheet contains the base-case model. It calculates an expansion project's cash flows and performance measures using base-case, or most likely, values for the input variables. It also includes the basic analysis but with straight-line depreciation and bonus depreciation.Go to the menu "Files" at the top left of the menu bar.Select "Options" from the items in the first column.This will give you the screen shown below:The second worksheet (2-Sens) extends the basic model to include sensitivity analysis using Data Tables (we include a brief tutorial on the use of Data Tables). Worksheet 2-Sens also illustrates special cases of sensitivity analysis, including breakeven analysis, one-way data tables with multiple outputs, and two-way data tables.Worksheet 3a-Sens extends the basic model to include scenario analysis. Worksheet 3b-ScenMgr shows how to use Excel's Scenario Manager for scenario analysis.Worksheet 4-Sim extends the basic model to include simulation analysis. Worksheet 5-Replmt illustrates the analysis for a proposed cost-reducing replacement investment. Replacement decisions differ from expansion decisions because most of the cash flows are found by subtracting the old project's cash flows from those of the new project to calculate incremental cash flows for use in the analysis.Worksheet 6-DecTree extends the scenario analysis to examine two decision trees in which the decision is made in stages. The first one simply shows the situation where the firm can abandon the project if things are not working out and cash flows are negative. The second one involves a marketing study and a prototype of the final product designed to learn more about demand before deciding to go into full production.Worksheet Appendix 11-A provides depreciation tables as described in Appendix A of the textbook. It also shows examples using straight-line depreciation and bonus depreciation.11-1 Identifying Relevant Cash FlowsA proposal’s relevant project cash flows are the differences between the cash flows the firm will have if it implements the project versus the cash flows it will have if it rejects the project. These are called incremental cash flows.Choose "Formulas" in the first column.11-2 Analysis of an Expansion ProjectThis will give you the screen shown below.The figure below shows the inputs and key results of Project L (one of the projects whose cash flows are used in the previous chapter); the actual analysis is conducted further below in the worksheet. The values in the Inputs section are linked to the model, as are the values shown in Key Results. If you change any of the values in the Input Section, the model recalculate almost instantly, causing ch ...
Slide 1: Title Slide
Extrachromosomal Inheritance
Slide 2: Introduction to Extrachromosomal Inheritance
Definition: Extrachromosomal inheritance refers to the transmission of genetic material that is not found within the nucleus.
Key Components: Involves genes located in mitochondria, chloroplasts, and plasmids.
Slide 3: Mitochondrial Inheritance
Mitochondria: Organelles responsible for energy production.
Mitochondrial DNA (mtDNA): Circular DNA molecule found in mitochondria.
Inheritance Pattern: Maternally inherited, meaning it is passed from mothers to all their offspring.
Diseases: Examples include Leber’s hereditary optic neuropathy (LHON) and mitochondrial myopathy.
Slide 4: Chloroplast Inheritance
Chloroplasts: Organelles responsible for photosynthesis in plants.
Chloroplast DNA (cpDNA): Circular DNA molecule found in chloroplasts.
Inheritance Pattern: Often maternally inherited in most plants, but can vary in some species.
Examples: Variegation in plants, where leaf color patterns are determined by chloroplast DNA.
Slide 5: Plasmid Inheritance
Plasmids: Small, circular DNA molecules found in bacteria and some eukaryotes.
Features: Can carry antibiotic resistance genes and can be transferred between cells through processes like conjugation.
Significance: Important in biotechnology for gene cloning and genetic engineering.
Slide 6: Mechanisms of Extrachromosomal Inheritance
Non-Mendelian Patterns: Do not follow Mendel’s laws of inheritance.
Cytoplasmic Segregation: During cell division, organelles like mitochondria and chloroplasts are randomly distributed to daughter cells.
Heteroplasmy: Presence of more than one type of organellar genome within a cell, leading to variation in expression.
Slide 7: Examples of Extrachromosomal Inheritance
Four O’clock Plant (Mirabilis jalapa): Shows variegated leaves due to different cpDNA in leaf cells.
Petite Mutants in Yeast: Result from mutations in mitochondrial DNA affecting respiration.
Slide 8: Importance of Extrachromosomal Inheritance
Evolution: Provides insight into the evolution of eukaryotic cells.
Medicine: Understanding mitochondrial inheritance helps in diagnosing and treating mitochondrial diseases.
Agriculture: Chloroplast inheritance can be used in plant breeding and genetic modification.
Slide 9: Recent Research and Advances
Gene Editing: Techniques like CRISPR-Cas9 are being used to edit mitochondrial and chloroplast DNA.
Therapies: Development of mitochondrial replacement therapy (MRT) for preventing mitochondrial diseases.
Slide 10: Conclusion
Summary: Extrachromosomal inheritance involves the transmission of genetic material outside the nucleus and plays a crucial role in genetics, medicine, and biotechnology.
Future Directions: Continued research and technological advancements hold promise for new treatments and applications.
Slide 11: Questions and Discussion
Invite Audience: Open the floor for any questions or further discussion on the topic.
Richard's aventures in two entangled wonderlandsRichard Gill
Since the loophole-free Bell experiments of 2020 and the Nobel prizes in physics of 2022, critics of Bell's work have retreated to the fortress of super-determinism. Now, super-determinism is a derogatory word - it just means "determinism". Palmer, Hance and Hossenfelder argue that quantum mechanics and determinism are not incompatible, using a sophisticated mathematical construction based on a subtle thinning of allowed states and measurements in quantum mechanics, such that what is left appears to make Bell's argument fail, without altering the empirical predictions of quantum mechanics. I think however that it is a smoke screen, and the slogan "lost in math" comes to my mind. I will discuss some other recent disproofs of Bell's theorem using the language of causality based on causal graphs. Causal thinking is also central to law and justice. I will mention surprising connections to my work on serial killer nurse cases, in particular the Dutch case of Lucia de Berk and the current UK case of Lucy Letby.
The increased availability of biomedical data, particularly in the public domain, offers the opportunity to better understand human health and to develop effective therapeutics for a wide range of unmet medical needs. However, data scientists remain stymied by the fact that data remain hard to find and to productively reuse because data and their metadata i) are wholly inaccessible, ii) are in non-standard or incompatible representations, iii) do not conform to community standards, and iv) have unclear or highly restricted terms and conditions that preclude legitimate reuse. These limitations require a rethink on data can be made machine and AI-ready - the key motivation behind the FAIR Guiding Principles. Concurrently, while recent efforts have explored the use of deep learning to fuse disparate data into predictive models for a wide range of biomedical applications, these models often fail even when the correct answer is already known, and fail to explain individual predictions in terms that data scientists can appreciate. These limitations suggest that new methods to produce practical artificial intelligence are still needed.
In this talk, I will discuss our work in (1) building an integrative knowledge infrastructure to prepare FAIR and "AI-ready" data and services along with (2) neurosymbolic AI methods to improve the quality of predictions and to generate plausible explanations. Attention is given to standards, platforms, and methods to wrangle knowledge into simple, but effective semantic and latent representations, and to make these available into standards-compliant and discoverable interfaces that can be used in model building, validation, and explanation. Our work, and those of others in the field, creates a baseline for building trustworthy and easy to deploy AI models in biomedicine.
Bio
Dr. Michel Dumontier is the Distinguished Professor of Data Science at Maastricht University, founder and executive director of the Institute of Data Science, and co-founder of the FAIR (Findable, Accessible, Interoperable and Reusable) data principles. His research explores socio-technological approaches for responsible discovery science, which includes collaborative multi-modal knowledge graphs, privacy-preserving distributed data mining, and AI methods for drug discovery and personalized medicine. His work is supported through the Dutch National Research Agenda, the Netherlands Organisation for Scientific Research, Horizon Europe, the European Open Science Cloud, the US National Institutes of Health, and a Marie-Curie Innovative Training Network. He is the editor-in-chief for the journal Data Science and is internationally recognized for his contributions in bioinformatics, biomedical informatics, and semantic technologies including ontologies and linked data.
A brief information about the SCOP protein database used in bioinformatics.
The Structural Classification of Proteins (SCOP) database is a comprehensive and authoritative resource for the structural and evolutionary relationships of proteins. It provides a detailed and curated classification of protein structures, grouping them into families, superfamilies, and folds based on their structural and sequence similarities.
Introduction:
RNA interference (RNAi) or Post-Transcriptional Gene Silencing (PTGS) is an important biological process for modulating eukaryotic gene expression.
It is highly conserved process of posttranscriptional gene silencing by which double stranded RNA (dsRNA) causes sequence-specific degradation of mRNA sequences.
dsRNA-induced gene silencing (RNAi) is reported in a wide range of eukaryotes ranging from worms, insects, mammals and plants.
This process mediates resistance to both endogenous parasitic and exogenous pathogenic nucleic acids, and regulates the expression of protein-coding genes.
What are small ncRNAs?
micro RNA (miRNA)
short interfering RNA (siRNA)
Properties of small non-coding RNA:
Involved in silencing mRNA transcripts.
Called “small” because they are usually only about 21-24 nucleotides long.
Synthesized by first cutting up longer precursor sequences (like the 61nt one that Lee discovered).
Silence an mRNA by base pairing with some sequence on the mRNA.
Discovery of siRNA?
The first small RNA:
In 1993 Rosalind Lee (Victor Ambros lab) was studying a non- coding gene in C. elegans, lin-4, that was involved in silencing of another gene, lin-14, at the appropriate time in the
development of the worm C. elegans.
Two small transcripts of lin-4 (22nt and 61nt) were found to be complementary to a sequence in the 3' UTR of lin-14.
Because lin-4 encoded no protein, she deduced that it must be these transcripts that are causing the silencing by RNA-RNA interactions.
Types of RNAi ( non coding RNA)
MiRNA
Length (23-25 nt)
Trans acting
Binds with target MRNA in mismatch
Translation inhibition
Si RNA
Length 21 nt.
Cis acting
Bind with target Mrna in perfect complementary sequence
Piwi-RNA
Length ; 25 to 36 nt.
Expressed in Germ Cells
Regulates trnasposomes activity
MECHANISM OF RNAI:
First the double-stranded RNA teams up with a protein complex named Dicer, which cuts the long RNA into short pieces.
Then another protein complex called RISC (RNA-induced silencing complex) discards one of the two RNA strands.
The RISC-docked, single-stranded RNA then pairs with the homologous mRNA and destroys it.
THE RISC COMPLEX:
RISC is large(>500kD) RNA multi- protein Binding complex which triggers MRNA degradation in response to MRNA
Unwinding of double stranded Si RNA by ATP independent Helicase
Active component of RISC is Ago proteins( ENDONUCLEASE) which cleave target MRNA.
DICER: endonuclease (RNase Family III)
Argonaute: Central Component of the RNA-Induced Silencing Complex (RISC)
One strand of the dsRNA produced by Dicer is retained in the RISC complex in association with Argonaute
ARGONAUTE PROTEIN :
1.PAZ(PIWI/Argonaute/ Zwille)- Recognition of target MRNA
2.PIWI (p-element induced wimpy Testis)- breaks Phosphodiester bond of mRNA.)RNAse H activity.
MiRNA:
The Double-stranded RNAs are naturally produced in eukaryotic cells during development, and they have a key role in regulating gene expression .
Professional air quality monitoring systems provide immediate, on-site data for analysis, compliance, and decision-making.
Monitor common gases, weather parameters, particulates.
THE IMPORTANCE OF MARTIAN ATMOSPHERE SAMPLE RETURN.Sérgio Sacani
The return of a sample of near-surface atmosphere from Mars would facilitate answers to several first-order science questions surrounding the formation and evolution of the planet. One of the important aspects of terrestrial planet formation in general is the role that primary atmospheres played in influencing the chemistry and structure of the planets and their antecedents. Studies of the martian atmosphere can be used to investigate the role of a primary atmosphere in its history. Atmosphere samples would also inform our understanding of the near-surface chemistry of the planet, and ultimately the prospects for life. High-precision isotopic analyses of constituent gases are needed to address these questions, requiring that the analyses are made on returned samples rather than in situ.
THE IMPORTANCE OF MARTIAN ATMOSPHERE SAMPLE RETURN.
Cpph exam a_2019_s1
1. CPPH501 – PAPER A. (2019 S1)
1
YEAR:
Student Number
Surname & Initials
2019
SEMESTER:
ASSESSMENT:
1
A
SUBJECT NAME: Computer Programming 1
SUBJECT CODE: CPPH501
QUALIFICATION(S): D3IP13 /INDUSTRIAL PHYSICS
PAPER DESCRIPTION: COMPUTER
BASED
DURATION: 3 HOURS PAPER: ONLY
SPECIAL REQUIREMENTS
NONE
NON-PROGRAMMABLE POCKET CALCULATOR
SCIENTIFIC CALCULATOR
COMPUTER ANSWER SHEET
GRAPH PAPER
DRAWING INSTRUMENTS
OTHER: COMPUTER
INSTRUCTIONS TO CANDIDATES: ANSWER ALL QUESTIONS
THIS TEST IS TO BE ANSWERED ON https://mytutor.tut.ac.za
WHEN YOU ARE DONE. GIVE YOUR ANSWER SCRIPT BACK TO THE
INVIGILATOR AND SUBMIT YOUR FILE.
TOTAL NUMBER OF PAGES INCLUDING COVER PAGE: 12
TOTAL NUMBER OF ANNEXURES: 0
EXAMINER: W BHEBE FULL MARKS: 96
MODERATOR: A KHOZA TOTAL MARKS: 96
STUDENT TOTAL: ___
STUDENT %: ___
Tshwane Universit)
of Technology
2. CPPH501 – PAPER A. (2019 S1)
2
QUESTION 1 [10]
STATEMENT TRUE FALSE
Theory
1.1 The float and double data types in C++ store real numbers.
1.2 The condition in the selection structure specifies the decision you are
making and is phrased so that it results in either a true or false answer
only.
1.3 The repetition structure is used to repeatedly process one or more
program instructions until some condition is met, at which time the
structure ends.
1.4 A function header in a C++ program does not end with a semicolon.
1.5 You cannot include actual arguments when you call a void function.
1.6 A repetition structure can only include one instruction.
1.7 To use the predefined function sqrt(), the program must include
the header file cmath.
1.8 The output of the statement:
cout << pow(3.0, 2.0) + 5 << endl; is 14.
1.9 The following is an example of a valid function prototype:
void calc(double, double, double &, double &);
1.10 The built-in srand function is an example of a value-returning
function.
3. CPPH501 – PAPER A. (2019 S1)
3
QUESTION 2 [10]
In each of the following statements, choose the only correct answer.
2.1 The ____ structure makes a decision and then takes an appropriate action based on
that decision
a. selection
b. case
c. repetition
d. iteration
e. None of the above
2.2 ____ is an example of a syntax error.
a. cout<<’Hello’;
b. cin>>raiseRate;
c. cout<<”New Pay :”<<newPay<<endl;
d. average =number1 +number2/2;
e. None of the above
2.3 The ____ statement tells the computer to leave the switch statement at that point.
a. break
b. continue
c. stop
d. case
e. None of the above
2.4 If the default clause is not the last clause in the switch statement, you will need to
Include a ____ statement at the end of the clause to stop the computer from
processing the instructions in the next case clause.
.
a. continue
b. break
c. stop
d. switch
e. None of the above
2.5 A loop that processes its instructions indefinitely is referred to as a(n) ____ loop.
a. infinite
b. non sentinel
c. accumulating
d. incorrect
e. None of the above
4. CPPH501 – PAPER A. (2019 S1)
4
2.6 Every C++ program contains at least one function: ____.
a. main()
b. pow()
c. return()
d. rand()
e. None of the above
2.7 In standard C++, the random number generator is a built-in function named ____.
a. rand()
b. random()
c. rnd()
d. rndm()
e. None of the above
2.8 When a function definition appears below the main () function, you must enter a
function ____ above the main() function.
a. argument
b. parameter
c. prototype
d. declaration
e. None of the above
2.9 To pass a variable by reference in C++, you include a (n) ____ before the name of
the corresponding formal parameter in the receiving function’s header.
a. *
b. @
c. #
d. &
e. None of the above
2.10 ____ is an example of a valid function call.
a. void calc(double, double, double &, double &);
b. calc(salary, raiseRate, raise, newSalary);
c. void calc(double current, double rate, double &increase, double &pay)
d. calc(salary, raiseRate, &raise, &newSalary);
e. None of the above
5. CPPH501 – PAPER A. (2019 S1)
5
QUESTION 2 (MULTIPLE CHOICE)
2.1 a b c d e
2.2 a b c d e
2.3 a b c d e
2.4 a b c d e
2.5 a b c d e
2.6 a b c d e
2.7 a b c d e
2.8 a b c d e
2.9 a b c d e
2.10 a b c d e
6. CPPH501 – PAPER A. (2019 S1)
6
QUESTION 3 [21]
3.1 What is an escape character? Give an example. [2]
3.2 Propose an appropriate prototype of a function that will return the higher of any two
numbers passed as argument to the function [4]
3.3. Write C++ statements for the following: [3]
𝑝𝑝 = �𝑎𝑎2 + 𝑏𝑏2
7. CPPH501 – PAPER A. (2019 S1)
7
3.4. Write C++ statements for the following: [3]
𝑠𝑠𝑠𝑠𝑠𝑠 =
𝑎𝑎(𝑟𝑟𝑛𝑛
− 1)
𝑟𝑟 − 1
3.5 Explain in your own words, the term ‘modularity’ [3]
8. CPPH501 – PAPER A. (2019 S1)
8
3.6 Study the following code and rewrite the program using a “for” loop [6]
Write your answer in the space provided below
int number = 1;
do
{
cout << number <<
endl; number++;
} while (number <= 10);
9. CPPH501 – PAPER A. (2019 S1)
9
QUESTION 4 [16]
Create a program that displays a series of the first 10 Fibonacci numbers (1, 1, 2, 3, 5, 8,
13, 21, 34, and 55). Notice that, beginning with the third number in the series, each
Fibonacci number is the sum of the prior two numbers. In other words, 2 is the sum of 1
plus 1, 3 is the sum of 1 plus 2, 5 is the sum of 2 plus 3, and so on. Write two versions of
the code: one using the for statement and the other using the while statement. Enter
the C++ instructions into a source file named Question5.cpp. Add appropriate comments
and any additional instructions required to execute your program. Note: the Fibonacci
numbers should appear twice on the screen. Refer to figure 4.1 for sample output.
Figure 4.1
QUESTION 5 [6]
Write a C++ for loop that will produce the output in figure 5.1. Include appropriate
comments and any additional instructions required to execute your program.
Figure 5.1
I C:Usersraphirits.TUTD~sktopSickT~st2D~bugSickT~st2.~x~
i s playing t e the FIRST 10 i onacci
umbers us ing [for s tatement]
i s playing the the FIRST 10 Fibonacci
umbers us ing [while s t a tement]
any key to continue . . . _
Squat'e
4
16
36
64
100
any key
Cube
8
64
216
512
1000
to continue
V
10. CPPH501 – PAPER A. (2019 S1)
10
Question 6 [23]
Create a program for the sales manager at Computer Haven, a small business that offers
motivational seminars to local companies. Table 6-1 shows the charge for attending a
seminar. Notice that the charge per person depends on the number of people the company
registers. For example, the cost for four registrants is R5 761.32; the cost for two registrants
is R4 321.0. The program should allow the sales manager to enter the number of registrants
for as many companies as needed. When the sales manager has finished entering the data,
the program should calculate and display the total number of people registered, the total
charge for those registrants, and the average charge per registrant. For example, if one
company registers four people and another company registers two people, the total number
of people registered is six, the total charge is R10 082.32, and the average charge per
registrant is R1680.38.
Number of people a
company registers
Charge per person (R)
1 – 3 2160.50
4 – 9 1440.33
10 or more 1296.30
Table 6.1
Include necessary statements to compile and run your program. See figure 6.1 for sample
output.
11. CPPH501 – PAPER A. (2019 S1)
11
Figure 5-1
QUESTION 7 [10]
Write, compile and run a C++ program to input the following values into an array
named velocity: 10.95, 16.32, 12.14, 8.33, 45.20, 36.45, 7.89, 12.35 and 11.54.
After your data has been entered have your program display the values.
first coApany (negative nuAber to stop the prograA): 4
registered by the next coApany (negative nuAber to stop the prograA): 2
registered by the next coApany (negative nuAber to stop the prograA): -5
otal nuAber of registrants: 6
otal charge for all registrants: R10082.32
uerage charge per registrant: R1680.39
registered by the next COApany (negative
registered by the next COApany (negative
registered by the next COApany (negative
registered by the next COApany (negative
registered by the next COApany (negative
registered by the next COApany (negative
registered by the next COApany (negative
registered by the next COApany (negative
registered by the next COApany (negative
otal nuAber of registrants: 50
otal charge for all registrants: R?561?.39
verage charge per registrant: R1512.35
nm11ber to stop the pl"Ogl"aA): 8
nm11ber to stop the pl"Ogl"aA): 3
nm11ber to stop the pl"Ogl"aA): 1
nm11ber to stop the pl"Ogl"aA): 3
nm11ber to stop the pl"Ogl"aA): 4
nm11ber to stop the pl"Ogl"aA): ?
nm11ber to stop the pl"Ogl"aA): 10
nm11ber to stop the pl"Ogl"aA): 9
nm11ber to stop the pl"Ogl"aA): -1
y
12. CPPH501 – PAPER A. (2019 S1)
12
INSTRUCTIONS TO STUDENTS
- All codes must be copied into a single file (MS word file, or any other format
recommended by the lecturer)
- The file name must match your student number
- Student name and student number must be written at the top of the submitted file!!
- All practical work must be submitted on myTutor
- Make sure the lecturer or invigilator has collected your project before leaving the
venue!