Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a ) Find the values of the following variables, a , b , c , d , and e . For example, your STUDENT ID

a) Find the values of the following variables, a, b, c, d, and e. For example, your STUDENT ID is 011202029 and therefore, the value of LAST_THREE_DIGIT_OF_YOUR_STUDENT_ID is 029. Use your own student ID. int a = LAST_THREE_DIGIT_OF_YOUR_STUDENT_ID %5; int b = LAST_THREE_DIGIT_OF_YOUR_STUDENT_ID /5; float c = LAST_THREE_DIGIT_OF_YOUR_STUDENT_ID /5; float d =(float) LAST_THREE_DIGIT_OF_YOUR_STUDENT_ID/5; float e = a*b-d/c; [2.5] b) Find output from the given code segment for each of the values of choice variable i) choice = LAST_THREE_DIGIT_OF_YOUR_STUDENT_ID ii) choice = LAST_THREE_DIGIT_OF_YOUR_STUDENT_ID+11 iii) choice = LAST_THREE_DIGIT_OF_YOUR_STUDENT_ID+21 a = LAST_THREE_DIGIT_OF_YOUR_STUDENT_ID; b = a +10; c = a +20; printf(BEGIN
); if ( choice < a ) printf(UIU
); else if (( choice >= b) && (choice <= c)) printf(CSE
); else printf(NICE
); printf(END); [2.5]2 a) Show the manual tracing for the following code segment a = LAST_TWO_DIGIT_OF_YOUR_STUDENT_ID%2+3; b = LAST_TWO_DIGIT_OF_YOUR_STUDENT_ID %2+2; c = LAST_TWO_DIGIT_OF_YOUR_STUDENT_ID %2+4; printf(START); switch( a + b - c ){ case 0: printf(
%d %d %d, a, b, c); break; case 1: printf(
%d %d %d, a*2, b*2, c*3); case 3: printf(
%d %d %d, a+1, b+2, c+3); break; [2.5] United International University (UIU) Dept. of Computer Science & Engineering (CSE) Page 2 of 2 default: printf(
%d %d %d, a-1, b-1, c-1); } printf(
STOP); b) Write a program to perform the following operations i) Assign integer variable a by the LAST_THREE_DIGIT OF YOUR STUDENT_ID; ii) Assign integer variable b by the (LAST_ONE_DIGIT OF YOUR STUDENT_ID+3); iii) Increase a by 1 iv) Decrease b by 1 v) If a is less than b, output will be Division not possible vi) If a is divisible by b, output will be a, b, quotient of a/b vii) If a is not divisible by b, output will be a, b, quotient and remainder of a/b [2.5]3 a) Show the manual tracing for the following code segment and find output int n = LAST_THREE_DIGIT OF YOUR STUDENT_ID; int i = n-2; int sum =0; while( i <= n ){ sum = sum+i; printf(
%d %d, i, sum); ++i; } printf(
%d %d, i, sum); [2.5] b) Write a program that calculates the summation of the following series a+(a+i)+(a+2i)+(a+3i)+...+(a+10i) Where a = LAST_THREE_DIGIT OF YOUR STUDENT_ID and i =(LAST_ONE_DIGIT OF YOUR STUDENT_ID+2)[2.5]4 a) Show the manual tracing for the following code segment and find output int A[4]={0}; int i; a = LAST_TWO_DIGIT_OF_YOUR_STUDENT_ID+1; b = LAST_TWO_DIGIT_OF_YOUR_STUDENT_ID+2; c = LAST_TWO_DIGIT_OF_YOUR_STUDENT_ID+3; d = LAST_TWO_DIGIT_OF_YOUR_STUDENT_ID+4; A[0]=a; A[1]=b; A[2]=c; A[3]=d; for(i=3; i>=0; --i){ if(A[i]%2==0) printf(A[%d]=%d
, i, A[i]); }[2.5] b) Write a program to perform the following operations i) Declare a one-dimensional array A of size 10 ii) Store the number a,(a+i),(a+2i),(a+3i),...(a+9i) in the array A, Where a= LAST_THREE_DIGIT OF YOUR STUDENT_ID and i=(LAST_ONE_DIGIT OF YOUR STUDENT_ID+2) iii) Print the numbers in array A on the monitor in reverse order.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Define the term telecommuting.

Answered: 1 week ago