WorksheetsWeek 4 Quiz: AI Fundamentals
Total questions: 8
Worksheet time: 6mins
You're setting up the Gemini API for the first time. Where should you store your API key for a Python project?
Hardcode it directly in your Python script: api_key = "AIzaSy..."
Store it in a .env file and load with python-dotenv
Pass it as a command-line argument every time you run the script
Store it in a public GitHub repository for easy access
You're building a chatbot that should always respond as a friendly pirate. Where should you define this behavior?
In each user message: "Respond like a pirate: [user question]"
In the system prompt, set once at the beginning
In the temperature parameter
In the model selection
Which temperature setting should you use when extracting specific dates and dollar amounts from contracts?
temperature=2.0
temperature=1.0
temperature=0.5
temperature=0.0
You want to classify support tickets into 5 categories. How many examples should you include in your prompt for optimal few-shot learning?
1 example (one-shot learning)
3-5 examples (standard few-shot)
20+ examples (many-shot)
No examples (zero-shot is better)
When using response_mime_type="application/json", what problem does this solve?
It makes the API request faster
It reduces API costs
It prevents the LLM from wrapping JSON in markdown code blocks
It allows the model to understand JSON input better
What is the correct way to send a PDF file to Gemini's multimodal API?
Extract text with PyPDF2 first, then send as string
Convert PDF to images, then send each image separately
Read PDF as bytes and send with mime_type="application/pdf"
Upload PDF to cloud storage and send the URL
Your document processor receives a scanned PDF (image-only, no text layer).
What happens when you send it to a multimodal Gemini model via the API?
The API returns an error because it can't read scanned documents
Gemini automatically performs OCR and extracts the text
You must use Tesseract OCR first, then send the extracted text
The API only reads the metadata, not the content
You're processing 100 documents but hit "Rate limit exceeded" after 15 documents. What's the best solution?
Reduce temperature to 0.0 to speed up processing
Add time.sleep(4) between API calls to stay under 15 requests/minute
Switch to a smaller model like Gemini Nano
Process all 100 documents simultaneously with threading
