Answer:
A 1 MB digital file needs 0.23 seconds to transfer over a channel with bandwidth 10 MHz and SNR 10 dB.
Explanation:
We can calculate the channel capacity using Shannon's Capacity formula:
C = B + log₂ (1 + SNR)
Where C = Channel Capacity
B = Bandwidth of the Channel
SNR = Signal to Noise Ratio
We are given SNR in dB so we need to convert it into a ratio.
= 10log₁₀ (SNR)
10 = 10log₁₀ (SNR)
1 = log₁₀ (SNR)
SNR = 10¹
SNR = 10
So, using Shannon Channel Capacity formula:
C = 10 x 10⁶ log₂ (1 + 10)
C = 34.5 MHz
Total amount of time required to transmit a 1MB file:
1MB = 1 x 8 Mbytes = 8Mb
C = 34.5 MHz = 34.5 Mb/s
Time required = 8Mb/34.5Mb/s = 0.23 seconds
A 1 MB digital file needs 0.23 seconds to transfer over a channel with bandwidth 10 MHz and SNR 10 dB.
Bob Kahn and Vint Cerf were both pioneers of the Internet, and Tim Berners-Lee was known for inventing the WWW.
Answer:
- public static String bothStart(String text1, String text2){
- String s = "";
-
- if(text1.length() > text2.length()) {
- for (int i = 0; i < text2.length(); i++) {
- if (text1.charAt(i) == text2.charAt(i)) {
- s += text1.charAt(i);
- }else{
- break;
- }
- }
- return s;
- }else{
- for (int i = 0; i < text1.length(); i++) {
- if (text1.charAt(i) == text2.charAt(i)) {
- s += text1.charAt(i);
- }else{
- break;
- }
- }
- return s;
- }
- }
Explanation:
Let's start with creating a static method <em>bothStart()</em> with two String type parameters, <em>text1 </em>&<em> text2</em> (Line 1).
<em />
Create a String type variable, <em>s,</em> which will hold the value of the longest substring that both inputs start with the same character (Line 2).
There are two possible situation here: either <em>text1 </em>longer than<em> text2 </em>or vice versa. Hence, we need to create if-else statements to handle these two position conditions (Line 4 & Line 13).
If the length of<em> text1</em> is longer than <em>text2</em>, the for-loop should only traverse both of strings up to the length of the <em>text2 </em>(Line 5). Within the for-loop, we can use<em> charAt()</em> method to extract individual character from the<em> text1</em> & <em>text2 </em>and compare with each other (Line 15). If they are matched, the character should be joined with the string s (Line 16). If not, break the loop.
The program logic from (Line 14 - 20) is similar to the code segment above (Line 4 -12) except for-loop traverse up to the length of <em>text1 .</em>
<em />
At the end, return the s as output (Line 21).
They work in many different ways?