# Computer Science

## A roullette wheel has 18 red, 18 black, and one zero slots. With each play of the game, a gambler bets \$1 on red. Gambler’s initial capital is \$10. A game is over when the gambler either wins \$ 10 (his capital becomes \$20) or becomes broke (capital = \$0). Create a command button (B8) and assign it to a code to estimate the probability of becoming broke (D8). (use 10,000 simulation runs; you can use the VBA Rnd function as a random number generator) Run

EXPERT ANSWER the code is self explanatory 18 red balls 18 black balls 1 zero slot probability of red ball is 18/37 probability of black ball is 18/37 probability of zero slot is 1/37 generate a random number in 0 to 1 if the number lies between 0 and 18/37 , its a red ball, …

## Create a command button (B6) and assign it to a code that writes the first 20 elements of the Fibonacci sequence in range D6:D25 (the first two elements of the sequence are 0 and 1; after that, each subsequent number is the sum of the two previous numbers). Run

EXPERT ANSWER Answer:- Program: Private Sub CommandButton1_Click()Dim a, b, c, i As Integera = 0b = 1Cells(6, 4) = aCells(7, 4) = b For i = 8 To 25c = a + bCells(i, 4) = ca = bb = cNext i End Sub Output:

## 4. Write a program to find the frequency of each vowel in a string. Input String: Final Assignment Array: a e i o u Character Frequency 2 1 2 0 0

EXPERT ANSWER Solution: CODE: .MODEL SMALL.STACK 100H .DATA PROMPT_1 DB ‘Enter a string : \$’PROMPT_2 DB 0DH,0AH,’No. of Vowels = \$’PROMPT_3 DB 0DH,0AH,’No. of Consonants = \$’ STRING DB 50 DUP (?)C_VOWELS DB ‘AEIOU’S_VOWELS DB ‘aeiou’C_CONSONANTS DB ‘BCDFGHJKLMNPQRSTVWXYZ’S_CONSONANTS DB ‘bcdfghjklmnpqrstvwxyz’ .CODEMAIN PROCMOV AX, @DATA ; initialize DS and ESMOV DS, AXMOV ES, AX LEA DX, …

## Given a group of boxes, you are requested to arrange these boxes on top of each other to reach the maximum possible height. Note: a box cannot be placed on top of another box unless the area of its 2D base is smaller or equal of the 2D base of the lower box. It is allowed to rotated any box to use any two sides as its base.

Given a group of boxes, you are requested to arrange these boxes on top of each other to reach the maximum possible height. Note: a box cannot be placed on top of another box unless the area of its 2D base is smaller or equal of the 2D base of the lower box. It is …

## Using implicit Intents, you are to write a complete Android application, using menus or BottomNavigationView to

Using implicit Intents, you are to write a complete Android application, using menus or BottomNavigationView to 1. Allow the user to send SMS messages to multiple users at the same time.2. Allow the user to send E-mail to multiple users including CC and BCC3. Allow the user to Locate any specific place on Google Map by …

## Given a group of boxes, you are requested to arrange these boxes on top of each other to reach the maximum possible height. Note: a box cannot be placed on top of another box unless the area of its 2D base is smaller or equal of the 2D base of the lower box. It is allowed to rotated any box to use any two sides as its base.

Given a group of boxes, you are requested to arrange these boxes on top of each other to reach the maximum possible height. Note: a box cannot be placed on top of another box unless the area of its 2D base is smaller or equal of the 2D base of the lower box. It is …

## P46. Consider that only a single TCP (Reno) connection uses one 10Mbps link which does not buffer any data. Suppose that this link is the only congested link between the sending and receiving hosts. Assume that the TCP sender has a huge file to send to the receiver, and the receiver❝s receive buffer is much larger than the congestion window. We also make the following assumptions: each TCP segment size is 1,500 bytes; the two-way propagation delay of this connection is 150 msec; and this TCP connection is always in congestion avoidance phase, that is, ignore slow start. a. What is the maximum window size (in segments) that this TCP connection can achieve? b. What is the average window size (in segments) and average throughput (in bps) of this TCP connection? c. How long would it take for this TCP connection to reach its maximum window again after recovering from a packet loss?

P46. Consider that only a single TCP (Reno) connection uses one 10Mbps link which does not buffer any data. Suppose that this link is the only congested link between the sending and receiving hosts. Assume that the TCP sender has a huge file to send to the receiver, and the receiver❝s receive buffer is much …

## Problem 2. Write a program to convert an infix expression that includes ∧ ,(),,+,−,∗ , and / to postfix. Given an infix expression in the form of a string str. Convert this infix expression to postfix expression. – Infix expression: The expression of the form A op B. When an operator is in-between every pair of operands. – Postfix expression: The expression of the form A B op. When an operator is followed for every pair of operands. Example: – Input-Infix expression: A+B ∗ (C ∧ D−E) ∧ (F+G ∗ H)−I Output – Postfix expression: ABCD ∧ E−FGHH ∗ + ∧ +I – – Input – Infix expression: A ∗ (B+C)/D Output – Postfix expression: ABC+∗D/

EXPERT ANSWER INPUT :A+B∗(C∧D−E)∧(F+G∗H)−IOUPUT:ABCD∧E−FGHH∗+∧+ICONCEPTS OF STACKS ARE USED HERE TO SOLVE THE PROBLEM