1 - جامعة نزوى



|Instructor's Name |Room |Ext. |Email |Office Hours |

|Mr.Lohani khan |11i15 |597 |lohani@unizwa.edu.om | |

COMP151 INTRODUCTION TO ALGORITHMS AND PROGRAMMING

ASSIGNMENT – III

STUDENT’S NAME: _________________________________________________

STUDENT’S ID: _____________________________________________________

SECTION: ______

|[pic] |College of Arts and Sciences |

| |Department of Mathematical and Physical Science |

| |Section: Computer Science |

| |Semester: spring 2014 |

1. Find the result for the following expressions -8 Marks

|Expression |Result |

|5+2*4 | |

|10/2-3 | |

|8+12*2-4 | |

|4+17%2-1 | |

|6-3*2+7-1 | |

|6+3*5 | |

|12/2-4 | |

|9+14*2-6 | |

|5+19%3-1 | |

|(6+2)*3 | |

|14/(11-4) | |

|9+12*(8-3) | |

|(6+17)%2-1 | |

|(9-3)*(6+9)/3 | |

|12+22%4*4+12-6/2 | |

|45+2*3*4%2-3+72 | |

2. True or False: It’s perfectly all right to use variables of different data types in the same arithmetic expression -1 Mark

3. An arithmetic assignment operator combines the effect of what two operators? -1 Mark

4. Convert the following Algebraic Expression into C++ Expression -3 Marks

|Algebraic Expression |C++ Expression |

|[pic] | |

|[pic] | |

|[pic] | |

|[pic] | |

|[pic] | |

|[pic] | |

5. Write a statement that uses an arithmetic assignment operator to increase the value of the variable temp by 23. Write the same statement without the arithmetic assignment operator. - 2 Marks

6. Write a program to check the given number is less than 100 or greater than 100 by using ternary operator. - 2 Marks

7. Write a program to find the biggest among three numbers through conditional operator. - 2 Marks

8. What is the output of the following program? - 2 Marks

#include

using namespace std;

int main()

{

int x=10,y=25,c,d;

c=++x;

cout ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download