1. Which of the following is a valid assignment operator?

a) +=

b) -=

c) *=

d) All of the mentioned

### View Answer

2. What does the **= assignment operator do?

a) Multiplies the value twice

b) It is used as exponent like 2**3=8

c) It is the multiplication operator.

d) None of the mentioned

### View Answer

3. What is the output of the given code?

counter = 2 while counter < 68 puts counter counter**=2 end

a) 2 4 16 64

b) 2 4 16

c) 2 4 16 256

d) None of the mentioned

### View Answer

Output: 2 4 16

4. What is the output of the given code?

counter = 1 while counter < 11 puts counter counter+=1 end

a) 1 2 3 4 5

b) 1…10

c) 1..10

d) None of the mentioned

### View Answer

Output: 1 2 3 4 5 6 7 8 9 10

5. Ruby does not support ++ operator, it only supports += operator.

a) True

b) False

### View Answer

6. What is the output of the given code?

counter = 100 while counter > 0 puts counter counter/=5 end

a) 100 20 4

b) 100 20 5

c) 100..5

d) None of the mentioned

### View Answer

Output: 100 20 4

7. What is the output of the given code?

counter = 100 while counter > 0 puts counter counter-=25 end

a) 100 75 50 25

b) 100 25 5

c) 100..5

d) None of the mentioned

### View Answer

Output: 100 75 50 25

8. What is the output of the given code?

counter = -50 while counter <0 puts counter counter+=10 end

a) 100 75 50 25

b) -50 -40 -30 -20 -10

c) 100..5

d) None of the mentioned

### View Answer

Output: -50 -40 -30 -20 -10

9. The given two expression means the same.

counter=counter+1 and counter++

a) True

b) False

### View Answer

10. What is the output of the given code?

a = 22.5 while a >11.5 puts a a-=3.5 end

a) 22.5 19.0 15.5 12.0

b) 22.5 11.5

c) 100..5

d) None of the mentioned

### View Answer

Output: 22.5 19.0 15.5 12.0

11. What is the output of the given code?

a = 5 b=10 while a <10 && b<20 puts a+b a+=2 b+=2 end

a) 10 20

b) 15 19 23

c) 15 16 17 18 19 20

d) None of the mentioned

### View Answer

Output: 15 19 23

12. What is the output of the given code?

a = 5 b=10 while a <10 && b<20 puts a*b a+=2 b+=2 end

a) 10 20

b) 15 19 23

c) 50 84 126

d) None of the mentioned

### View Answer

Output: 50 84 126

13. What is the output of the given code?

a= 5 b=10 while a <10 && b<20 puts a-b a+=2 b+=2 end

a) 10 20

b) 15 19 23

c) -5 -5 -5

d) None of the mentioned

### View Answer

Output: -5 -5 -5

14. What is the output of the given code?

a = 5 b=10 while a <10 || b<20 puts a*b a+=2 b+=2 end

a) 10 20

b) 50 84 126 176 234

c) -5 -5 -5

d) None of the mentioned

### View Answer

Output: 50 84 126 176 234

15. What is the output of the given code?

a = 5 b=10 while (a <10 || b<20)&&true puts a*b a+=2 b+=2 end

a) 10 20

b) 50 84 126 176 234

c) -5 -5 -5

d) None of the mentioned

### View Answer

Output: 50 84 126 176 234

### Synopsis and Project Report

You can buy synopsis and project from distpub.com. Just visit https://distpub.com/product-category/projects/ and buy your university/institute project from distpub.com