Please select a subject first
Advertisements
Advertisements
Exchange the contents: Given two glasses marked A and B. Glass A is full of apple drink and glass B is full of grape drink. Write the specification for exchanging the contents of glasses A and B, and write a sequence of assignments to satisfy the specification.
Concept: undefined >> undefined
Decanting problem. You are given three bottles of capacities 5,8 and 3 litres. The 8L bottle is filled with oil, while the other two are empty. Divide the oil in an 8L bottle into two equal quantities. Represent the state of the process by appropriate variables. What are the initial and final states of the process? Model the decanting of oil from one bottle to another by assignment. Write a sequence of assignments to achieve the final state.
Concept: undefined >> undefined
Advertisements
Suppose u, v = 10 ,5 before the assignment. What are the values of u and v after the sequence of assignments?
1 u := v
2 v := u
Concept: undefined >> undefined
Which of the following properties is true after the assignment (at line 3)?
1 --i, j = 0, 0
2 i, j := i+1, j-1
3 --?
Concept: undefined >> undefined
If C1 is false and C2 is true, the compound statement
1 if C1
2 S1
3 else
4 if C2
5 S2
6 else
7 S3
executes
Concept: undefined >> undefined
How many times the loop is iterated?
i := 0
while i ≠ 5
i := i + 1
Concept: undefined >> undefined
A loop invariant need not be true ______
Concept: undefined >> undefined
Define a loop invariant.
Concept: undefined >> undefined
Does testing the loop condition affect the loop invariant? Why?
Concept: undefined >> undefined
What is the relationship between loop invariant, loop condition, and the input-output recursively?
Concept: undefined >> undefined
What is the use of a header file?
Concept: undefined >> undefined
What is the alternate name of the null statement?
Concept: undefined >> undefined
In C++, the group of statements should be enclosed within: ______
Concept: undefined >> undefined
Identify the odd one from the keywords of jump statements?
Concept: undefined >> undefined
What are a null statement and compound statement?
Concept: undefined >> undefined
Correct the following code sigment:
if (x = 1)
p = 100;
else
p = 10;
Concept: undefined >> undefined
Compare an if and a ? : operator.
Concept: undefined >> undefined
Write a program to find the LCM and GCD of two numbers.
Concept: undefined >> undefined
Write a program to find sum of the series
S = 1 + x + x2 +..... + xn
Concept: undefined >> undefined
The paradigm which aims more at procedures.
Concept: undefined >> undefined
