Bird
Raised Fist0
Prompt Engineering / GenAIml~20 mins

What Generative AI actually is in Prompt Engineering / GenAI - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Generative AI Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Generative AI Outputs

Which of the following best describes what Generative AI does?

AIt only classifies existing data into categories without creating anything new.
BIt creates new content like images, text, or music based on patterns it learned.
CIt stores large amounts of data without processing or generating anything.
DIt deletes irrelevant data to make storage more efficient.
Attempts:
2 left
💡 Hint

Think about how AI can make something new rather than just sorting or storing.

Predict Output
intermediate
2:00remaining
Output of a Simple Text Generation Model

What will be the output of this simple text generation code snippet?

Prompt Engineering / GenAI
import random
words = ['cat', 'dog', 'bird']
def generate_sentence():
    return 'I see a ' + random.choice(words)

print(generate_sentence())
AI see a random animal
BI see a cat dog bird
CError because random.choice is not defined
DI see a cat (or dog or bird) - one of these randomly chosen each run
Attempts:
2 left
💡 Hint

Look at how random.choice picks one word from the list each time.

Model Choice
advanced
2:00remaining
Choosing the Right Model for Generative AI

Which model type is best suited for generating new images based on learned patterns?

AGenerative Adversarial Network (GAN) designed to create new images
BConvolutional Neural Network (CNN) used for image classification
CRecurrent Neural Network (RNN) used for time series prediction
DDecision Tree used for data splitting
Attempts:
2 left
💡 Hint

Think about models that can create new images, not just analyze them.

Metrics
advanced
2:00remaining
Evaluating Generative AI Quality

Which metric is commonly used to measure how realistic images generated by AI are?

AInception Score measuring image quality and diversity
BAccuracy score comparing predicted labels
CMean Squared Error measuring numeric prediction error
DConfusion Matrix showing classification errors
Attempts:
2 left
💡 Hint

This metric looks at both how good and how varied generated images are.

🔧 Debug
expert
2:00remaining
Debugging a Text Generation Model Output

Given this code snippet for generating text, what error will it raise?

Prompt Engineering / GenAI
def generate_text(words):
    return ' '.join(words)

print(generate_text('hello world'))
ASyntaxError due to missing colon
BNameError because 'words' is not defined
CNo error, outputs 'h e l l o w o r l d'
DTypeError because 'str' object is not iterable as expected
Attempts:
2 left
💡 Hint

Consider whether passing a string to ' '.join() raises a TypeError and what the actual output is.

Practice

(1/5)
1. What is the main purpose of Generative AI?
easy
A. To store large amounts of data efficiently
B. To delete irrelevant information from datasets
C. To only classify existing data into categories
D. To create new content by learning from examples

Solution

  1. Step 1: Understand the role of Generative AI

    Generative AI learns patterns from data and creates new content based on those patterns.
  2. Step 2: Compare options with the definition

    Only To create new content by learning from examples describes creating new content by learning from examples, which matches the main purpose.
  3. Final Answer:

    To create new content by learning from examples -> Option D
  4. Quick Check:

    Generative AI = create new content [OK]
Hint: Generative AI makes new stuff from learned data [OK]
Common Mistakes:
  • Confusing Generative AI with data storage
  • Thinking it only classifies data
  • Believing it deletes data
2. Which of the following is the correct way to describe Generative AI in simple code terms?
easy
A. Train a model, then generate new outputs
B. Only collect data without processing
C. Manually write all new content
D. Delete old models before training

Solution

  1. Step 1: Identify the typical workflow of Generative AI

    Generative AI involves training a model on data and then using it to create new outputs.
  2. Step 2: Match options to this workflow

    Train a model, then generate new outputs correctly states this process, while others describe unrelated or incorrect actions.
  3. Final Answer:

    Train a model, then generate new outputs -> Option A
  4. Quick Check:

    Train then generate = correct process [OK]
Hint: Generative AI = train model + create new data [OK]
Common Mistakes:
  • Thinking Generative AI only collects data
  • Assuming manual content creation is AI
  • Confusing training with deleting models
3. Consider this Python-like pseudocode for a simple Generative AI process:
model = train(data)
new_content = model.generate()

What will new_content most likely contain?
medium
A. A new example similar to the training data
B. The original training data unchanged
C. An error message because generate() is undefined
D. An empty output with no content

Solution

  1. Step 1: Understand the code steps

    The code trains a model on data, then calls generate() to create new content.
  2. Step 2: Predict the output of generate()

    Generate() produces new content similar to what the model learned, not the original data or errors.
  3. Final Answer:

    A new example similar to the training data -> Option A
  4. Quick Check:

    generate() = new similar content [OK]
Hint: generate() creates new data like training examples [OK]
Common Mistakes:
  • Thinking generate() returns original data
  • Assuming generate() causes an error
  • Expecting empty output
4. The following code is intended to train a Generative AI model and generate new content:
model = train(data)
new_content = model.generate(data)

What is the likely problem here?
medium
A. model should be a list, not a model object
B. train() should not take data as input
C. generate() should not take data as input after training
D. new_content should be assigned before training

Solution

  1. Step 1: Review typical usage of generate()

    After training, generate() usually creates new content without needing input data again.
  2. Step 2: Identify misuse in code

    Passing data to generate() is incorrect; it should generate based on learned patterns alone.
  3. Final Answer:

    generate() should not take data as input after training -> Option C
  4. Quick Check:

    generate() no input needed [OK]
Hint: generate() uses learned model, no extra data input [OK]
Common Mistakes:
  • Thinking train() shouldn't take data
  • Confusing model type
  • Assigning new_content before training
5. You want to create a Generative AI that writes short poems. Which steps best describe the process?
hard
A. Write poems manually, then use AI to classify them
B. Collect poem examples, train model on them, generate new poems
C. Train model on random text, then delete training data
D. Generate poems first, then collect examples to train

Solution

  1. Step 1: Understand the goal of Generative AI for poems

    The AI needs to learn from existing poems to create new ones.
  2. Step 2: Identify the correct sequence of actions

    Collecting examples, training the model, then generating new poems is the correct order.
  3. Final Answer:

    Collect poem examples, train model on them, generate new poems -> Option B
  4. Quick Check:

    Learn from examples, then create new [OK]
Hint: Train on examples first, then generate new content [OK]
Common Mistakes:
  • Trying to generate before training
  • Confusing classification with generation
  • Deleting training data too early