The large energy cost of memory fetches limits the overallefficiency of applications no matter how efficient the accelerators are on the chip. As a result the most importantoptimization must be done at the algorithm level, to reduce offchip memory accesses, to createDark Memory. The algorithmsmust first be (re)written for both locality and parallelism beforeyou tailor the hardware to accelerate them.Using Pareto curves in theenergy/opandmm2/(op/s)spaceallows one to quickly evaluate different accelerators, memorysystems, and even algorithms to understand the tradeoffsbetween performance, power and die area. This analysis isa powerful way to optimize chips in the Dark Silicon era.
CS201 Assignment 1 Solution and Discssion

Assignment No. 1
Semester: Fall 2019
CS201 – Introduction to Programming Total Marks: 20Due Date: November 14, 2019
Instructions
Please read the following instructions carefully before submitting assignment:
It should be clear that your assignment will not get any credit if:o Assignment is submitted after due date.
o Submitted assignment does not open or file is corrupt.
o Assignment is copied (From internet/students).Software allowed to develop Assignment
 Dev C++
Objectives:
To enable students to understand and practice the concepts of:
• Variables and operators
• Loops or repetition structures
• Ifelse statements
• Functions
• Random number generation
• Control random number in specific rangeAssignment Submission Instructions
You have to submit only.cpp file on the assignments interface of CS201 at VULMS. Assignment submitted in any other format will not be accepted and will be graded zero marks.
Please note again, assignment submitted other than .cpp format will get zero marks.Assignment
Programming is a nice tool which can be used to make our life easier. With the help of programming we can do many things auto generated and efficiency. As a programmer first task of this semester is given to you is develop a consolebased application for school teachers. This application will auto generate questions for Grades 1, 2, 3, 4 and 5. Using this application teacher will be able to give different paper to each student.
Assignment Statement:
Write a menubased program in C++ that will take input from user(teacher) and fulfill following requirements.• There should be a menu that allow to select grade of class.
• Created questions should be mixed type (addition and subtraction).
• User will give number of questions that will be generated for a paper.
• Ratio of addition and subtraction questions is not fixed. It will random, a paper can have more questions of one type than other. See sample output screenshot.
• Number of minimum and maximum digits in paper of grade 1 will be two.
• Number of minimum and maximum digits in paper of grade 2 will be three.
• Number of minimum and maximum digits in paper of grade 3 will be four.
• Number of minimum and maximum digits in paper of grade 4 will be five.
• Number of minimum and maximum digits in paper of grade 5 will be six.
• Screen shot of required application is given below as simple output.
• Most critical requirement is, the operand (number) on left side of subtraction sign must be larger than the number on right side of sign (operator). This requirement is highlighted in sample screenshot too.
• In case of addition operation, the operand (number) on left side of addition sign can be larger or smaller from the number on right side of sign (operator).Solution instructions:
• Variables, loops, ifelse, rand() function with % operator, functions (one which return a value and one which do not return a value) will help you to solve the problem.
• Use rand() function to generate a random number. You can control the range of number with the help of modulus (%) operator.
• To use rand() function you must include “stdlib.h” header file.
• To control the range of random number rand() % N can help, if value of N will be 100 then range of randomly generated number will be 0 to 99.
• If you want to control the range of random number between 10 to 19 then following formula will help.
o [10 + rand() % (19 – 10 + 1)]Sample output:
Lectures Covered: (Lecture # 1 10) and Solution Deadline: (November 14, 2019).

Solution Code
#include <iostream> #include <iomanip> #include <stdlib.h> using namespace std; int selectGrade(){ int grade = 0; cout<<"1 : First Grade\n"; cout<<"2 : Second Grade\n"; cout<<"3 : Third Grade\n"; cout<<"4 : Fourth Grade\n"; cout<<"5 : Fifth Grade\n"; cout<<"\nPlease select grade, use numbers 1 to 5: "; do { cin>>grade; if(grade >= 1 && grade <= 5){ break; } else { cout<<"\nGrade must be between 1 and 5\n"; cout<<"Invalid choice, please select correct grade: "; } } while(true); return grade; } void createQuestions(int l, int u, int q){ int firstNum = 0, secondNum = 0; for(int i = 1; i <= q; i++){ firstNum = l + (rand() % (u  l + 1)); secondNum = l + (rand() % (u  l + 1)); cout<<setw(2)<<i<<"."; if(rand() % 2 == 0){ cout<<" ("<<firstNum<<" + "<<secondNum<<") = ______\t\t";; } else{ if(firstNum > secondNum) { cout<<" ("<<firstNum<<"  "<<secondNum<<") = ______\t\t"; } else{ cout<<" ("<<secondNum<<"  "<<firstNum<<") = ______\t\t"; } } if(i % 3 == 0){ cout<<"\n"; } } } void generatePaper(int grade, int questions) { int lowerLimit, Upperlimit; if(grade == 1){ lowerLimit = 10; Upperlimit = 99; createQuestions(lowerLimit, Upperlimit, questions); } else if(grade == 2){ lowerLimit = 100; Upperlimit = 999; createQuestions(lowerLimit, Upperlimit, questions); } else if(grade == 3){ lowerLimit = 1000; Upperlimit = 9999; createQuestions(lowerLimit, Upperlimit, questions); } else if(grade == 4){ lowerLimit = 10000; Upperlimit = 99999; createQuestions(lowerLimit, Upperlimit, questions); } else if(grade == 5){ lowerLimit = 100000; Upperlimit = 999909; createQuestions(lowerLimit, Upperlimit, questions); } } main(){ int grade = 0, numQuestions = 0; grade = selectGrade(); cout<<"Enter number of questions you want to generate: "; cin>>numQuestions; cout<<endl; generatePaper(grade, numQuestions); cout<<endl; system("pause"); }
Recent Topics

CS502 Midterm Solved Papers Mid and Final
CS502  Fundamentals of Algorithms6 
CS301 Quiz 1 Solution and Discussion
CS301 – Data Structures5 
UNSOLVED MTH404 Assignment 2 Solution and Discussion
MTH404  Dynamics5 
org.jetbrains.kotlin.util.KotlinFrontEndException: Exception while analyzing expression
Android Development4 
STAT408 Assignment 1 Solution and Discussion
STAT408  Experimental Design Analysis4 
SOLVED MTH304 Assignment 2 Solution and Discussion
MTH304  Statics4 
SOLVED CS510 Assignment 1 Solution and Discussion
CS510  Software Requirements and Specifications2 
SOLVED BNK603 Assignment 1 Solution and Discussion
BNK603  Consumer Banking2 
SOLVED CS510 Assignment 2 Solution and Discussion
CS510  Software Requirements and Specifications2 
UNSOLVED BIF501 Assignment 1 Solution and Discussion
BIF501  Bioinformatics II2 
SOLVED MTH621 Assignment 1 Solution and Discussion
MTH621  Real Analysis I2 
BIO731 Assignment 1 Solution and Discussion
BIO731  Advanced Molecular Biology1 
EDU602 Assignment 1 Solution and Discussion
EDU602  Educational Leadership and Management1 
MTH101 Assignment 1 Solution and Discussion
MTH101  Calculus And Analytical Geometry1 
EDU602 Quiz 2 Solution and Discussion
EDU602  Educational Leadership and Management1 
BNK603 Quiz 2 Solution and Discussion
BNK603  Consumer Banking1 
PM Modi Fallon on stairs
General Discussion1 
GEN733 Assignment 1 Solution and Discussion
GEN733  Biometrical Techniques in Genetics1 
BIO734 Assignment 1 Solution and Discussion
BIO734  Advances in Cell Biology1 
BIF604 Assignment 1 Solution and Discussion
BIF604  Special Topics in Bioinformatics1