Tuesday 7 May 2013

CS410 Assignment No 02 Solution Spring 2013

Assignment No. 2
Semester: SPRING 2013
CS410 – VISUAL PROGRAMMING
Total Marks: 20
Due Date:
6th May, 2013
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/From students).
You should consult recommended books to clarify your concepts and can also put queries on MDB.
Objective
To understand the concepts of Macros, Switch Statement and Bitwise Operators.
Software (s) Used to develop Assignment
Visual C++ 6.0 And MS Word
Language
C/C++
Assignment Submission Instructions
Assignment should be submitted in a zipped folder named "VU-RollNo" format, which includes
following files:
→ Question No. 1 should be in "Question1.cpp" format.
→ Question No. 2 should be in "Question2.doc" format.
Assignment
Marks Distribution:
10+10= 20
Background:
XYZ Technologies
XYZ Technologies is a leading international provider of automated and IT enabled solutions catering to
businesses across various verticals around the globe. Since its inception in 1995, XYZ has regimented itself being
committed to deliver the best software solutions. XYZ has ever since used highly experienced resources in
analysis, development, quality assurance, and implementation to provide a wide range of high-quality consulting
services and cost-effective development of customized application software. XYZ's worldwide domain and
subject matter expertise, proven track record and the capability to act as solution integrators can give you a truly
cost-effective solution that not only meets, but surpasses your needs.
Scenario:
XYZ –Prohibition Period For Win32 Programmers
During the recruitment session the HR department of XYZ company has selected some competent people. After
the interview session some of them have been hired. As per company policy the starting 1 month will be
probation period for them in which their performance will be judged through some practical tasks. Then
successful candidates will be promoted, else fired.
Evaluation:
Now being selected, you need to perform the given task. The task consists of 2 parts; the first is about
developing a code and second is solving certain expressions.
Part 1:
Write a program which performs basic four mathematical operations i.e. Addition, Subtraction, Multiplication
and Division.
1. Develop a function named "menu". The users can select any option from the given menu.
When user will press 'A' it will perform Addition and so on. Use switch statement to achieve
this functionality.
2. To perform operations (Addition, Subtraction, Multiplication and Division) you have to
define macros.
Note: A video demo is also attached to illustrate about the other requirements and output format of the
program.
Part 2:
Consider the following code snippet:
unsigned int x, y, z, r;
x=0xA502;
y=0xB610;
z=0x540C;
First convert the x, y, z values into binary form and then solve the following bitwise expressions.
1. x&y=?
2. y|z=?
3. r=(x2) + (y>>4)=?
4. z^r=?
Note: You have to solve each expression like this
x= (Binary value)
y= (Binary value)
(x&y)= (Binary value)
= (Convert final output into Hex Value)
Lectures Covered: This Assignment covers Lecture No.5 – Lecture No. 7
Deadline: Your assignment must be uploaded on or before 06th May, 2013.


Complete Solution

complete answer of question 2.
X2 = (1001010000001000)
y>>4 = (1111101101100001)+
ans=
r=(x2) + (y>>4)=?(11000111101101001)
(x&y)=(1010010000000000)
(Y|z)=( 1111 011000011100)
z^r=(11101101101100101)
but some problem. after adding r=(x2) + (y>>4)=?(11000111101101001) the answer is in 17 digit number. and after doing this z^r=(11101101101100101) ans is also in 17 digits i am confused what i do is it right answer? or not. i am confused how we write number for binarry addition.
11000111101101001
0101 0100 0000 1100



--
Need Your Comments.....!

-- 

For University of Pakistan Study Material Sharing, Discussion, etc, Come and join us at http://4e542a34.linkbucks.com
You received this message because you are subscribed to the Google
Groups "Study" group.
To post to this group, send email to http://ca13054d.tinylinks.co
For more options, visit this group at
http://004bbb67.any.gs

No comments:

Post a Comment

Note: only a member of this blog may post a comment.