Java: Generate Random Number Between 1 & 100

Instructions:

Choose an answer and hit 'next'. You will receive your score and answers at the end.

question 1 of 3

Based on the Java code below, what is true about the variable r?

Create Your Account To Take This Quiz

As a member, you'll also get unlimited access to over 75,000 lessons in math, English, science, history, and more. Plus, get practice tests, quizzes, and personalized coaching to help you succeed.

Try it risk-free
Try it risk-free for 30 days. Cancel anytime.
Already registered? Log in here for access

1. In the Java code below, what is the data type of the variable max?

2. The Java Random class has a function that lets you generate a _____ number

Create your account to access this entire worksheet
A Premium account gives you access to all lesson, practice exams, quizzes & worksheets
Access to all video lessons
Quizzes, practice exams & worksheets
Certificate of Completion
Access to instructors
Create an account to get started Create Account

About This Quiz & Worksheet

Answer these questions to see if you know how to use Java to generate a random number. You must identify the different functions you will need to perform this action.

Quiz & Worksheet Goals

In this set of quiz questions you'll make sure you remember:

  • The purpose of the Java Random Class
  • Data types in Java
  • What type of number is generated by different Java commands

Skills Practiced

  • Reading comprehension - ensure that you draw the most important information from the material, such as what data types are used in Java
  • Critical thinking - apply relevant concepts to examine information about creating random numbers using Java commands in a different light
  • Problem solving - use acquired knowledge to solve Java randomization practice problems

Additional Learning

If you want to learn more about this programming language, read the lesson titled Java: Generate Random Number Between 1 & 100. It covers:

  • The Java utility library
  • Examples of Java randomization
  • The level of randomness Java is capable of generating
Support