Question

In: Computer Science

Assume i = 4, j = 9, k = 5 and m = -3. What does...

Assume i = 4, j = 9, k = 5 and m = -3. What does each of the following statements print?

a) printf("%d", i == 4);

b) printf("%d", j!= 3);

c) printf("%d", i >= 5 && j < 2);

d) printf("%d", !m || k > m);

e) printf("%d", !k && m);

f) printf("%d", k - m < j || 5 - j >= k);

g) printf("%d", j + m <= i && !0);

h) printf("%d", !(j + m)); i) printf("%d", !(k < m)); j) printf("%d", !(j < k));

Solutions

Expert Solution

i = 4, j = 9, k = 5 and m = -3.

printf("%d", i == 4);

Yes. i==4

Ans:1

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

printf("%d", j!= 3);

i is not equal to 3. True

Ans:1

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

printf("%d", i >= 5 && j < 2);

i>=5 ==>False

j<2==>False

0 && 0 =0

ANs:0

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

printf("%d", !m || k > m);

m is a non zero number. Hence !m is 0.

k>m is true.

0||1=1

Ans:1

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

printf("%d", !k && m);

k is a non zero number .!k is 0

m is also a non zero number

Hence k&&m is 0 && 1==>0

ANs: 0

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

printf("%d", k - m < j || 5 - j >= k);

k-m=5+3=8 ; 8<j (true)

5-j=5-9=4;4>=k (true)

true|| true==>true(1)

Ans:1

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

printf("%d", j + m <= i && !0);

j+m=9-3=6; 6<=i (No- False)

!0==>true

true && false==>false(0)

Ans:0

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

printf("%d", !(j + m));

j+m=9-3=6

Its non zero number. Hence !1= 0

Ans:0

++++++++++++++++++++++++++++++++++++++++++++++++++++++++
printf("%d", !(k < m));

k<m is false.

!(false)==> True

Ans:1

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


printf("%d", !(j < k));

j<k is false;

!(fasle)==>true

Ans:1


Related Solutions

import java.util.*; class A { int i, j, k; public A(int i, int j, int k)...
import java.util.*; class A { int i, j, k; public A(int i, int j, int k) { this.i=i; this.j=j; this.k=k; } public String toString() { return "A("+i+","+j+","+k+")"; } } class Main { public static void main(String[] args) { ArrayList<A> aL=new ArrayList<A>(); Random rand= new Random(1000); //1000 is a seed value for (int p=0; p<10; p++) { int i = rand.nextInt(100); int j = rand.nextInt(200); int k = rand.nextInt(300); aL.add(new A(i, j, k)); } System.out.println("----- Original arraylist------"); for (A a: aL)...
Consider the group G = {1, −1, i, −i, j, −j, k, −k} under multiplication. Here...
Consider the group G = {1, −1, i, −i, j, −j, k, −k} under multiplication. Here i2= j2= k2= ijk = −1. determine which of the following sets is a subgroup of G. If a set is not a subgroup, give one reason why it is not. (a) {1, −1} (b) {i, −i, j, −j} (c) {1, −1, i, −i} (d) {1, i, −i, j}
Bond J is a 4 percent coupon bond. Bond K is a 9 percent coupon bond....
Bond J is a 4 percent coupon bond. Bond K is a 9 percent coupon bond. Both bonds have 8 years to maturity, make semiannual payments, and have a YTM of 9 percent. Requirement 1: (a) If interest rates suddenly rise by 5 percent, what is the percentage price change of Bond J? (b) If interest rates suddenly rise by 5 percent, what is the percentage price change of Bond K? Requirement 2: (a) If interest rates suddenly fall by...
3. Let S3 act on the set A={(i,j) : 1≤i,j≤3} by σ((i, j)) = (σ(i), σ(j))....
3. Let S3 act on the set A={(i,j) : 1≤i,j≤3} by σ((i, j)) = (σ(i), σ(j)). (a) Describe the orbits of this action. (b) Show this is a faithful action, i.e. that the permutation represen- tation φ:S3 →SA =S9 (c) For each σ ∈ S3, find the cycle decomposition of φ(σ) in S9.
A dipole moment, p = (2 Cm i) + (-5 Cm j) + (7 Cm k),...
A dipole moment, p = (2 Cm i) + (-5 Cm j) + (7 Cm k), is within an E = (-5 N/C i) + (6 N/C j) + (3 N/C k). - Determine the potential energy stored by the dipole in the field. - Determine the torque on the dipole by the field. - Determine the angle between the dipole moment and the field.
Equilibrium Concentrations 1 2 3 4 5 [FeSCN2+] 1.49x10-5 M 4.69x10-5 M 7.47x10-5 M 1.01x10-4 M...
Equilibrium Concentrations 1 2 3 4 5 [FeSCN2+] 1.49x10-5 M 4.69x10-5 M 7.47x10-5 M 1.01x10-4 M 2.65x10-4 M [Fe3+] 6.0x10-4 M 6.0x10-4 M 6.0x10-4 M 6.0x10-4 M 6.0x10-4 M [SCN-] 2.0x10-4 M 4.0x10-4 M 6.0x10-4 M 8.0x10-4 M 1.0x10-3 M Equilibrium Keq 124.2 195.4 207.5 210.4 441.7 Average Keq: 235.8 Does your data support a complete conversion or partial conversion? Based on your results was the measured Keq too high or too low? Explain please.
[ 1 -1 3 -3 5 2 ] A=[ 1 -1 4 -1 9 -4 ]...
[ 1 -1 3 -3 5 2 ] A=[ 1 -1 4 -1 9 -4 ] [ -1 1 -3 3 -4 8  ] [7] b=[5] [4] use the row reduction algorithm to solve the following Describe the solution set of Ax=b in parametric vector form describe the solution set of Ax=0 as Span[ V1,V2,....,Vp]
23. Consider the 5 x 6 matrix A whose (i,j)h element is aij i+j; (a) What...
23. Consider the 5 x 6 matrix A whose (i,j)h element is aij i+j; (a) What is A(10:20)? (b) What is k such that A(k) = A(3,4)? (c) Show how A is stored in sparse column format (d) Show how A is stored in sparse row format (e) What is the sparsity ratio?
x 2 8 5 9 4 3 9 6 7 8 y 3 6 5 7...
x 2 8 5 9 4 3 9 6 7 8 y 3 6 5 7 9 7 4 6 9 9 -5.48x + 0.17 5.48x + 0.17 -0.17x + 5.48 0.17x + 5.48
Give the JAVA code for the following IJVM: ILOAD j ILOAD k IADD BIPUSH 3 I...
Give the JAVA code for the following IJVM: ILOAD j ILOAD k IADD BIPUSH 3 I CMPEQ L1 ILOAD j BIPUSH 1 ISUB ISTORE j GOTO L2 L1: BIPUSH 0 ISTORE k L2:
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT