Bird
Raised Fist0
Signal Processingdata~20 mins

Digital modulation (ASK, FSK, PSK) in Signal Processing - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Digital Modulation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding ASK modulation characteristics
Which of the following statements correctly describes Amplitude Shift Keying (ASK) in digital modulation?
AASK varies both frequency and phase of the carrier signal simultaneously to represent digital data.
BASK varies the amplitude of the carrier signal to represent digital data while keeping frequency and phase constant.
CASK varies the phase of the carrier signal to represent digital data while keeping amplitude and frequency constant.
DASK varies the frequency of the carrier signal to represent digital data while keeping amplitude and phase constant.
Attempts:
2 left
💡 Hint

Think about which property of the carrier wave changes in ASK.

❓ Predict Output
intermediate
2:00remaining
Output of FSK signal generation code snippet
What is the shape of the output signal array generated by the following Python code simulating Frequency Shift Keying (FSK) for a 2-bit sequence?
Signal Processing
import numpy as np

bit_seq = [0, 1]
fs = 1000  # sampling frequency
bit_duration = 0.01  # seconds
f0 = 100  # frequency for bit 0
f1 = 200  # frequency for bit 1

signal = np.array([])
for bit in bit_seq:
    t = np.linspace(0, bit_duration, int(fs * bit_duration), endpoint=False)
    freq = f0 if bit == 0 else f1
    wave = np.sin(2 * np.pi * freq * t)
    signal = np.concatenate((signal, wave))

output_shape = signal.shape
A(100,)
B(10,)
C(200,)
D(20,)
Attempts:
2 left
💡 Hint

Calculate samples per bit: sampling frequency times bit duration.

❓ data_output
advanced
2:00remaining
PSK constellation points for binary data
Given a Binary Phase Shift Keying (BPSK) modulation with symbols mapped as 0 -> +1 and 1 -> -1 on the real axis, what is the resulting constellation array for the bit sequence [0, 1, 0, 1]?
Signal Processing
import numpy as np

bits = np.array([0, 1, 0, 1])
constellation = np.where(bits == 0, 1+0j, -1+0j)
A[1.+0.j, -1.+0.j, 1.+0.j, -1.+0.j]
B[0.+1.j, 0.-1.j, 0.+1.j, 0.-1.j]
C[1.+1.j, -1.-1.j, 1.+1.j, -1.-1.j]
D[-1.+0.j, 1.+0.j, -1.+0.j, 1.+0.j]
Attempts:
2 left
💡 Hint

Recall BPSK maps bits to points on the real axis.

❓ visualization
advanced
3:00remaining
Visualizing FSK signal for a 3-bit sequence
Which plot correctly shows the Frequency Shift Keying (FSK) signal for the bit sequence [1, 0, 1] with frequencies 150 Hz for bit 1 and 75 Hz for bit 0 over 0.02 seconds per bit?
Signal Processing
import numpy as np
import matplotlib.pyplot as plt

bit_seq = [1, 0, 1]
fs = 1000
bit_duration = 0.02
f1 = 150
f0 = 75
signal = np.array([])
time = np.array([])
for i, bit in enumerate(bit_seq):
    t = np.linspace(i*bit_duration, (i+1)*bit_duration, int(fs*bit_duration), endpoint=False)
    freq = f1 if bit == 1 else f0
    wave = np.sin(2 * np.pi * freq * (t - i*bit_duration))
    signal = np.concatenate((signal, wave))
    time = np.concatenate((time, t))
plt.plot(time, signal)
plt.xlabel('Time (s)')
plt.ylabel('Amplitude')
plt.title('FSK Signal')
plt.grid(True)
plt.show()
AA plot with three segments: high frequency sine wave, low frequency sine wave, high frequency sine wave.
BA plot with constant frequency sine wave throughout the time.
CA plot with three segments: low frequency sine wave, high frequency sine wave, low frequency sine wave.
DA plot with random noise instead of sine waves.
Attempts:
2 left
💡 Hint

FSK changes frequency based on bit value.

🔧 Debug
expert
3:00remaining
Identify error in PSK signal generation code
What error will the following Python code raise when generating a Phase Shift Keying (PSK) signal for bits [0, 1] with phases 0 and pi respectively? import numpy as np bits = [0, 1] fs = 1000 bit_duration = 0.01 phases = {0: 0, 1: np.pi} signal = np.array([]) for bit in bits: t = np.linspace(0, bit_duration, fs * bit_duration) wave = np.cos(2 * np.pi * 100 * t + phases[bit]) signal = np.concatenate(signal, wave)
Signal Processing
import numpy as np

bits = [0, 1]
fs = 1000
bit_duration = 0.01
phases = {0: 0, 1: np.pi}
signal = np.array([])
for bit in bits:
    t = np.linspace(0, bit_duration, int(fs * bit_duration))
    wave = np.cos(2 * np.pi * 100 * t + phases[bit])
    signal = np.concatenate((signal, wave))
ANameError: name 'np' is not defined
BValueError: operands could not be broadcast together
CTypeError: concatenate() takes 1 positional argument but 2 were given
DSyntaxError: invalid syntax
Attempts:
2 left
💡 Hint

Check how numpy.concatenate expects its arguments.

Practice

(1/5)
1. Which digital modulation technique changes the amplitude of the carrier wave to represent data bits?
easy
A. Phase Shift Keying (PSK)
B. Amplitude Shift Keying (ASK)
C. Frequency Shift Keying (FSK)
D. Pulse Code Modulation (PCM)

Solution

  1. Step 1: Understand modulation types

    ASK changes the amplitude of the carrier wave to represent data bits, while FSK changes frequency and PSK changes phase.
  2. Step 2: Match modulation to description

    The question asks for the technique that changes amplitude, which is ASK.
  3. Final Answer:

    Amplitude Shift Keying (ASK) -> Option B
  4. Quick Check:

    Amplitude change = ASK [OK]
Hint: ASK changes amplitude, FSK frequency, PSK phase [OK]
Common Mistakes:
  • Confusing ASK with FSK or PSK
  • Choosing PCM which is not a modulation technique
  • Mixing phase and amplitude changes
2. Which of the following is the correct Python syntax to generate a Frequency Shift Keying (FSK) signal using numpy arrays for two frequencies f1 and f2?
easy
A. signal = np.sin(2 * np.pi * f1 * t) + np.sin(2 * np.pi * f2 * t)
B. signal = np.cos(2 * np.pi * f1 * t) + np.cos(2 * np.pi * f2 * t)
C. signal = np.sin(2 * np.pi * f1 * t) * np.sin(2 * np.pi * f2 * t)
D. signal = np.sin(2 * np.pi * (f1 if bit == 0 else f2) * t)

Solution

  1. Step 1: Understand FSK signal generation

    FSK uses one frequency for bit 0 and another for bit 1, so the signal switches frequency based on the bit.
  2. Step 2: Check syntax for conditional frequency

    signal = np.sin(2 * np.pi * (f1 if bit == 0 else f2) * t) uses a conditional expression to select frequency based on bit, which is correct for FSK.
  3. Final Answer:

    signal = np.sin(2 * np.pi * (f1 if bit == 0 else f2) * t) -> Option D
  4. Quick Check:

    Conditional frequency selection = signal = np.sin(2 * np.pi * (f1 if bit == 0 else f2) * t) [OK]
Hint: FSK switches frequency based on bit using conditional [OK]
Common Mistakes:
  • Adding two sine waves instead of switching frequency
  • Multiplying sine waves which is incorrect
  • Using cosine instead of sine without reason
3. Given the following Python code snippet for Phase Shift Keying (PSK), what will be the output signal array for bits = [0, 1] and phase0 = 0, phase1 = pi?
import numpy as np
t = np.linspace(0, 1, 5)
bits = [0, 1]
phase0 = 0
phase1 = np.pi
signal = np.array([np.cos(2 * np.pi * 1 * t + (phase0 if bit == 0 else phase1)) for bit in bits])
print(signal)
medium
A. [[ 1. 0. -1. 0. 1.] [-1. 0. 1. 0. -1.]]
B. [[ 0. 0. 0. 0. 0.] [ 1. 1. 1. 1. 1.]]
C. [[ 1. 0. -1. 0. 1.] [ 1. 0. -1. 0. 1.]]
D. [[ 1. 1. 1. 1. 1.] [ 1. 1. 1. 1. 1.]]

Solution

  1. Step 1: Calculate cosine values for bit 0

    For bit 0, phase = 0, t = np.linspace(0,1,5) = [0, 0.25, 0.5, 0.75, 1], angles = 2πt = [0, π/2, π, 3π/2, 2π], cos = [1, 0, -1, 0, 1].
  2. Step 2: Calculate cosine values for bit 1

    For bit 1, phase = π, angles = 2πt + π, cos(θ + π) = -cos(θ) = [-1, 0, 1, 0, -1].
  3. Final Answer:

    [[ 1. 0. -1. 0. 1.] [-1. 0. 1. 0. -1.]] -> Option A
  4. Quick Check:

    PSK phase shift: cos(θ + π) = -cos(θ) [OK]
Hint: PSK phase π: cos(θ + π) = -cos(θ) [OK]
Common Mistakes:
  • Confusing phase shift effect on cosine
  • Misinterpreting array shape or values
  • Ignoring phase addition in cosine
4. The following code attempts to generate an ASK signal but produces an error. What is the error and how to fix it?
import numpy as np
bit = 0
t = np.linspace(0, 1, 100)
f = 5
signal = np.sin(2 * np.pi * f * t) if bit == 1 else 0
print(signal)
medium
A. Error: signal is assigned a scalar 0 instead of an array; fix by replacing 0 with np.zeros_like(t)
B. Error: np.sin requires integer input; fix by casting t to int
C. Error: Missing parentheses in np.sin; fix by adding parentheses
D. No error; code runs correctly

Solution

  1. Step 1: Identify the error in conditional assignment

    If bit == 1, signal is an array from np.sin, else signal is scalar 0, causing inconsistent types.
  2. Step 2: Fix by using array of zeros

    Replace 0 with np.zeros_like(t) to keep signal as an array in both cases.
  3. Final Answer:

    Error: signal is assigned a scalar 0 instead of an array; fix by replacing 0 with np.zeros_like(t) -> Option A
  4. Quick Check:

    Consistent array types needed = Error: signal is assigned a scalar 0 instead of an array; fix by replacing 0 with np.zeros_like(t) [OK]
Hint: Use np.zeros_like(t) for zero arrays, not scalar 0 [OK]
Common Mistakes:
  • Using scalar 0 causing type mismatch
  • Casting t to int which is unnecessary
  • Ignoring conditional expression structure
5. You want to design a digital communication system that must be robust to amplitude noise but can tolerate frequency variations. Which modulation technique should you choose and why?
hard
A. ASK, because it changes amplitude which is sensitive to noise
B. ASK, because it changes phase which is robust to amplitude noise
C. FSK, because it changes frequency which is less affected by amplitude noise
D. PSK, because it changes phase which is sensitive to frequency noise

Solution

  1. Step 1: Analyze noise tolerance requirements

    The system must be robust to amplitude noise, so modulation should not rely on amplitude changes.
  2. Step 2: Match modulation to noise tolerance

    FSK changes frequency, which is less affected by amplitude noise, making it suitable. ASK changes amplitude and is sensitive to amplitude noise. PSK changes phase and can be sensitive to frequency noise.
  3. Final Answer:

    FSK, because it changes frequency which is less affected by amplitude noise -> Option C
  4. Quick Check:

    Amplitude noise robustness = FSK [OK]
Hint: Choose FSK to avoid amplitude noise sensitivity [OK]
Common Mistakes:
  • Choosing ASK despite amplitude noise sensitivity
  • Confusing phase noise sensitivity with frequency noise
  • Misunderstanding modulation noise robustness
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard