# SP Contest 2

Please wait while the activity loads.

If this activity does not load, try refreshing your browser. Also, this page requires javascript. Please visit using a browser with javascript enabled.

If this activity does not load, try refreshing your browser. Also, this page requires javascript. Please visit using a browser with javascript enabled.

Question 1 |

In an experiment, one red dice and one black dice(both are fair) are rolled. What is the probability that,

- The number on black dice will divide the number on red dice.
- Number on black dice is multiple of the number on red dice.

22 / 36 and 14 / 36 respectively
| |

12 / 36 and 18 / 36 respectively | |

14 / 36 and 14 /36 respectively | |

6 / 36 and 8 / 36 respectively |

**SP Contest 2**

**Discuss it**

Question 1 Explanation:

We have two dice one is black and the other one is red:
There will be a total of 36 outcomes.

- We have to find the probability of the outcome that the number on black dice divides the number on red dice.
- 1 divides 1, 2, 3, 4, 5, 6.
- 2 divides 2, 4, 6.
- 3 divides 3, 6.
- 4 divides 4.
- 5 divides 5.
- 6 divides 6.

- We have to find the probability that the number on black dice is multiple of number on red dice.
- 1 is multiple of 1
- 2 is multiple of 1 and 2.
- 3 is multiple of 1 and 3.
- 4 is multiple of 1, 2 and 4
- 5 is multiple of 1 and 5.
- 6 is multiple of 1, 2, 3 and 6.

Question 2 |

What will be the remainder when 7

^{100}is divided by 5?0 | |

1 | |

2 | |

3 |

**SP Contest 2**

**Discuss it**

Question 2 Explanation:

This is a basic question of Chinese remainder theorem(CRT):
We can write 7

^{100}as (7^{4})^{25}. Now, 7^{4}= 2401 when we divide it by 5 then 1 will be the remainder. Now, 7^{100}as (7^{4})^{25}= (2401)^{25}mod 5 = 1^{25}mod 5 = 1. Therefore, (7^{100}% 5) = 1.Question 3 |

What will be the output of the below C program:

int calc(int i) { while(++i > 10); // statement 0 i++; return i; } int main() { int i = 2; printf("%d", calc(i)); return 0; }Also, if we replace pre-increment operator by post-increment operator in statement 0, then what will be the output of the new program?

11 and 12 | |

12 and 11 | |

4 and 5 | |

4 and 4 |

**SP Contest 2**

**Discuss it**

Question 4 |

Which of the following statement is used to copy data from one table and insert into another ?

SELECT AND INSERT INTO | |

INSERT INTO AND SELECT | |

SELECT FROM AND INSERT INTO | |

INSERT INTO SELECT |

**SP Contest 2**

**Discuss it**

Question 4 Explanation:

The INSERT INTO SELECT statement copies data from one table and inserts it into another table.
Example query :
INSERT INTO table1
SELECT * FROM table2
WHERE condition;

Question 5 |

Select the statements that are true about default and copy constructors in C++:

- Compiler doesn’t create a default constructor if the user writes any constructor except the copy constructor.
- Compiler creates a copy constructor if the user doesn't write its own copy constructor.
- Compiler doesn’t create a default constructor if the user writes any constructor even if it is copy constructor.

1 and 2 | |

Only 3 | |

Only 2 | |

2 and 3 |

**SP Contest 2**

**Discuss it**

Question 5 Explanation:

Question 6 |

Consider the following page reference string:

4, 3, 2, 1, 2, 1, 5, 6, 1, 2, 7, 6, 3, 1, 4, 2Which of the following options, gives the correct number of page faults related to LRU page replacement algorithms with 04 page frame and if there is an increment in page frame i.e. 05 page frame then what will be the correct number of page faults, assuming all frames are initially empty?

10 and 10 | |

11 and 10 | |

10 and 11 | |

11 and 11 |

**SP Contest 2**

**Discuss it**

Question 6 Explanation:

Least recently used (LRU) page replacement algorithm with 4 page frames:
Total number of page faults = 11
Least recently used (LRU) page replacement algorithm with 5 page frames:
Total number of page faults = 10
Therefore, option (B) is correct.

Question 7 |

What is the probability of getting a Saturday in a Week?

1 | |

1/7 | |

1/2 | |

2/7 | |

0 |

**SP Contest 2**

**Discuss it**

Question 7 Explanation:

Total number of Saturdays in a week = 1.
The possible number of Saturdays in a week = 1.
Therefore, the probability of getting a Saturday in a week = (1/1) = 1.

Question 8 |

A C++ class can contain a member of SELF type if the member is.

- Static
- Pointer
- Non-static

Only 3 | |

Both 2 and 3 | |

Both 1 and 2 | |

Only 1 |

**SP Contest 2**

**Discuss it**

Question 8 Explanation:

Question 9 |

What will be the output of the below C++ program?

#include<iostream> using namespace std; int main() { int a[] = {10,20,30,40,50}; cout<<(*(&a+1)-a); return 0; }

10 | |

0x7ffc7185f754 | |

50 | |

5 |

**SP Contest 2**

**Discuss it**

Question 9 Explanation:

Refer to

**method 2**of this post: https://www.geeksforgeeks.org/how-to-find-size-of-array-in-cc-without-using-sizeof-operator/Question 10 |

How does DHCP server dynamically assigns IP address to requesting host?

Dynamically, IP address is leased to requesting host for finite lease duration by DHCP server. | |

Dynamically IP address is leased to requesting host for an Infinite lease duration by DHCP server. | |

Dynamically, Static IP address is leased to requesting host for a finite lease duration by DHCP server. | |

Statically, dynamic IP address is leased to requesting host for an Infinite lease duration by DHCP server. |

**SP Contest 2**

**Discuss it**

Question 10 Explanation:

There are 10 questions to complete.