PYnative

Python Programming

  • Learn Python
  • Exercises
  • Quizzes
  • Code Editor
  • Tricks
Home » Python » Quizzes » Python Random Data Generation Quiz

Python Random Data Generation Quiz

Updated on: November 30, 2021 | 3 Comments

Following Python random data generation quiz provides Multiple Choice Questions to get familiar with random data generation in Python. Random data generation is useful in analytics and statistics. Also using random data generation, you can prepare test data.

This Quiz focuses on testing your knowledge on the random module, Secrets module, and UUID module.

The quiz contains 10 Questions. Solve 6 correct to pass the test.

Refer to the following tutorials to solve this quiz:

  • Tutorial: Generate random data in Python
  • Python secrets module to generate secure numbers
  • Python UUID Module

Also, See: Solve Python random data generation Exercise

1. I want to generate a random secure hex token of 32 bytes to reset the password, which method should I use

 
 
 
 

2. Choose the correct function from the following list to get the random integer between 99 to 200, which is divisible by 3.

 
 
 

3. To generate a random float number between 20.5 to 50.5, which function of a random module I need to use

 
 
 
 

4. The random.seed() method is used to initialize the pseudorandom number generator. The random module uses the seed value as a base to generate a random number. If seed value is not present, it takes the system’s current time.

 
 

5. Choose the correct function to get 3 elements from the list randomly in such a way that each element of the list has a different probability of being selected.

numberList = [100, 200, 300, 400, 500]
 
 
 

6. Which method should I use to get 4 elements from the following list randomly

samplelist = [20, 40, 60, 80, 100, 120, 140, 160, 180, 200]
 
 

7. To generate a random secure Universally unique ID which method should I use

 
 
 
 

8. str = “PYnative”. Choose the correct function to pick a single character from a given string randomly.

 
 
 

9. Which method should i use to capture and change the current state of the random generator

 
 

10. To Generate a random secure integer number, select all the correct options.

 
 
 

Loading ... Loading …

Loading

Filed Under: Python, Python Quizzes, Python Random

Did you find this page helpful? Let others know about it. Sharing helps me continue to create free Python resources.

TweetF  sharein  shareP  Pin

About Vishal

Founder of PYnative.com I am a Python developer and I love to write articles to help developers. Follow me on Twitter. All the best for your future Python endeavors!

Related Tutorial Topics:

Python Python Quizzes Python Random

Python Exercises and Quizzes

Free coding exercises and quizzes cover Python basics, data structure, data analytics, and more.

  • 15+ Topic-specific Exercises and Quizzes
  • Each Exercise contains 10 questions
  • Each Quiz contains 12-15 MCQ
Exercises
Quizzes

Comments

  1. NitpickingFellow says

    June 7, 2020 at 6:45 pm

    Question 8 is wrong,

    random.randrange(100, 200, 3)

    gives e random number in 100, 103.. 199. They are not multiple of 3.

    Reply
    • Vishal says

      June 8, 2020 at 9:25 am

      Hey NitpickingFellow, Thank you for your observation. I have updated the question now

      Reply
  2. Gil says

    November 30, 2019 at 2:32 am

    There’s a problem with the questions. Users can’t interact with the questions here. There’s just the submit button which works, but you can’t choose the answer you want.

    Reply

Leave a Reply Cancel reply

your email address will NOT be published. all comments are moderated according to our comment policy.

Use <pre> tag for posting code. E.g. <pre> Your code </pre>

Posted In

Python Python Quizzes Python Random
TweetF  sharein  shareP  Pin

  Python Quizzes

  • Python Quizzes Home
  • Basic Quiz For Beginners
  • Variables and Data Types Quiz
  • Operators and Expression Quiz
  • Input and Output Quiz
  • Functions Quiz
  • If Else and Loops Quiz
  • Numbers Quiz
  • String Quiz
  • List Quiz
  • Set Quiz
  • Dictionary Quiz
  • Tuple Quiz
  • File Handling Quiz
  • Random Data Generation Quiz

All Python Topics

Python Basics Python Exercises Python Quizzes Python File Handling Python OOP Python Date and Time Python Random Python Regex Python Pandas Python Databases Python MySQL Python PostgreSQL Python SQLite Python JSON

About PYnative

PYnative.com is for Python lovers. Here, You can get Tutorials, Exercises, and Quizzes to practice and improve your Python skills.

Explore Python

  • Learn Python
  • Python Basics
  • Python Databases
  • Python Exercises
  • Python Quizzes
  • Online Python Code Editor
  • Python Tricks

Follow Us

To get New Python Tutorials, Exercises, and Quizzes

  • Twitter
  • Facebook
  • Sitemap

Legal Stuff

  • About Us
  • Contact Us

We use cookies to improve your experience. While using PYnative, you agree to have read and accepted our Terms Of Use, Cookie Policy, and Privacy Policy.

Copyright © 2018–2022 pynative.com