Class Libraries

AP Computer Science A · Learn by Concept

Help Questions

AP Computer Science A › Class Libraries

1 - 10
1

What line of code is needed to import in order to use Color in the following format Color.Blue, Color.RED, Color.White?

import java.awt.*;

CORRECT

import java.awt.Color;

0

import java.util.Color;

0

import java.io.Color;

0

Explanation

If you were to use the following format Color.Red, Color.Blue, etc then the correct answer would have to be java.awt.*; While java.awt.Color; does fit the appropriate code, if you import that entire statement, you don't need to put Color.Red just Red and following. The other two import statements are just completely wrong.

2

What line of code is needed to import in order to use Color in the following format Color.Blue, Color.RED, Color.White?

import java.awt.*;

CORRECT

import java.awt.Color;

0

import java.util.Color;

0

import java.io.Color;

0

Explanation

If you were to use the following format Color.Red, Color.Blue, etc then the correct answer would have to be java.awt.*; While java.awt.Color; does fit the appropriate code, if you import that entire statement, you don't need to put Color.Red just Red and following. The other two import statements are just completely wrong.

3

What line of code is needed to import in order to use Color in the following format Color.Blue, Color.RED, Color.White?

import java.awt.*;

CORRECT

import java.awt.Color;

0

import java.util.Color;

0

import java.io.Color;

0

Explanation

If you were to use the following format Color.Red, Color.Blue, etc then the correct answer would have to be java.awt.*; While java.awt.Color; does fit the appropriate code, if you import that entire statement, you don't need to put Color.Red just Red and following. The other two import statements are just completely wrong.

4

Which of the following header statements allow you to omit using the std:: when using cout?

using namespace std;

CORRECT

#include

0

#include

0

#include

0

You don't need a header statement.

0

Explanation

You must put using namespace std; at the top of your file to avoid having to type std:: every time you use cout and cin.

5

Which of the following header statements allow you to omit using the std:: when using cout?

using namespace std;

CORRECT

#include

0

#include

0

#include

0

You don't need a header statement.

0

Explanation

You must put using namespace std; at the top of your file to avoid having to type std:: every time you use cout and cin.

6

Which of the following header statements allow you to omit using the std:: when using cout?

using namespace std;

CORRECT

#include

0

#include

0

#include

0

You don't need a header statement.

0

Explanation

You must put using namespace std; at the top of your file to avoid having to type std:: every time you use cout and cin.

7

Which of the following header statements allow you to omit using the std:: when using cout?

using namespace std;

CORRECT

#include

0

#include

0

#include

0

You don't need a header statement.

0

Explanation

You must put using namespace std; at the top of your file to avoid having to type std:: every time you use cout and cin.

8

Which of the following header statements allow you to omit using the std:: when using cout?

using namespace std;

CORRECT

using namespace std;

CORRECT

#include

0

#include

0

#include

0

#include

0

#include

0

#include

0

You don't need a header statement.

0

You don't need a header statement.

0

Explanation

You must put using namespace std; at the top of your file to avoid having to type std:: every time you use cout and cin.

9

Which of the access modifiers don't work in Java?

delete

CORRECT

static

0

final

0

abstract

0

Explanation

One of the benefits to Java is that there is garbage collection. So when data is disposed of its done automatically versus a language like C++ where you need to tell the program to delete dynamically allocated data.

10

Which of the access modifiers don't work in Java?

delete

CORRECT

static

0

final

0

abstract

0

Explanation

One of the benefits to Java is that there is garbage collection. So when data is disposed of its done automatically versus a language like C++ where you need to tell the program to delete dynamically allocated data.