暗記メーカー
ログイン
Mod 2: Comp Prog
  • iam noone

  • 問題数 55 • 2/14/2024

    記憶度

    完璧

    8

    覚えた

    21

    うろ覚え

    0

    苦手

    0

    未解答

    0

    アカウント登録して、解答結果を保存しよう

    問題一覧

  • 1

    are tokens that represent names of variables, methods, classes, and other user-defined program elements. All Java variables must be identified with unique names.

    Identifiers

  • 2

    Identifiers can be short names (like x and y) or more descriptive names (age, sum, totalVolume). It is recommended to use descriptive names in order to create understandable and maintainable code.

    True

  • 3

    The general rules for constructing names for an identifier (unique identifiers) are: Identifiers must begin with either a letter, an underscore “_”, or a dollar sign “$”. Letters may be lower or upper case. Subsequent characters may use numbers 0 to 9.

    True

  • 4

    Identifiers cannot use Java keywords like class, public, void, etc.

    True

  • 5

    Java Identifiers Best Practices For names of classes

    AnExampleOfClassName

  • 6

    Java Identifiers Best Practices: For names of methods and variables

    anExampleOfMethodName

  • 7

    Java Identifiers Best Practices: For names of constant

    EXAMPLE_OF_A_CONSTANT

  • 8

    Avoid using underscores at the start of the identifier such as _read or _write.

    true

  • 9

    is an item of data used to store the state of objects.

    Variable

  • 10

    determines the type of value that the variable can hold.

    Data Type

  • 11

    Name The variable name must follow rules for identifiers.

    True

  • 12

    is an attribute of data which tells the compiler or interpreter how the programmer intends to use the data.

    Data Type

  • 13

    Data types are divided into two groups: Primitive data types Non-primitive data types

    True

  • 14

    specifies the size and type of variable values, and it has no additional methods.

    Primitive Data Type

  • 15

    Stores whole numbers, positive or negative (such as 123 or -456), without decimals. Valid types are byte, short, int and long. Which type you should use, depends on the numeric value.

    Integer types

  • 16

    can store whole numbers from -128 to 127. This can be used instead of int or other integer types to save memory when you are certain that the value will be within -128 and 127.

    Byte

  • 17

    can store whole numbers from -32,768 to 32,767.

    Short

  • 18

    can store whole numbers from -2,147,483,648 to 2,147,483,647. In general, the int data type is the preferred data type when we create variables with a numeric value.

    Int

  • 19

    type can store whole numbers from 9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. This is used when int is not large enough to store the value.

    Long

  • 20

    Represents numbers with a fractional part, containing one or more decimals.

    Floating point Type

  • 21

    What are the two tyoes of floating data types:

    Float & double

  • 22

    can store fractional numbers from 3.4e−038 to 3.4e+038.

    Float

  • 23

    can store fractional numbers from 1.7e−308 to 1.7e+308.

    Double

  • 24

    The “precision of float” is only six(6) or seven(7) decimal digits, while “double variables” have a precision of about “15 digits”. Therefore it is safer to use double for most calculations.

    True

  • 25

    type is declared with the boolean keyword and can only take the values true or false.

    Boolean

  • 26

    type is used to store a single character. The character must be surrounded by single quotes, like 'A' or 'c':

    Character

  • 27

    types are called reference types because they refer to objects.

    Non - Primitive Data Types

  • 28

    Examples of non-primitive types are Strings, Arrays, Classes, Interface, etc.

    True

  • 29

    type is used to store a sequence of characters (text). String values must be surrounded by double quotes.

    Strings

  • 30

    is a statement that can convey a value. Some of the most common are mathematical, such as in the following source code example: int number = 4; int anotherNumber = number; int product = number * anotherNumber;

    Expressions

  • 31

    is a symbol that tells the compiler to perform specific mathematical or logical manipulations. Java is rich in built-in operators and provide the following types of operators: 1. Unary Operators 2. Arithmetic operators 3. Assignment operators 4. Relational operators 5. Logical operators

    Operators

  • 32

    are used with only one operand.

    Unary Operators

  • 33

    are used to perform common mathematical operations.

    Arithmetic operators

  • 34

    are used to assign values to variables.

    Assignment Operators

  • 35

    used to check the relationship between two operands.

    Relational operators

  • 36

    are used to check whether an expression is true or false. If the expression is true, it returns 1 whereas if the expression is false, it returns 0.

    Logical Operators

  • 37

    this line of code correct? System.out.println("The area is " + String.format(%.2f, area) + ".");

    False

  • 38

    Solve this expression, is the answer correct? int answer; answer = 50 * 2 - 15 / 3 + 10 % 2 + 6; System.out.print(answer); The answer is 101.

    True

  • 39

    Solve the expression, is the answer correct? double number; number = 20 / 2 * 4 - 2 + 10 - (-2); System.out.println(number); 50

    False

  • 40

    Solve the expression, is the answer correct? int number; number = 10 - 4 + 8 / 4 * 2; System.out.println(number); The answer is 10.

    true

  • 41

    Solve the expression, is the answer correct? double number; number = 40 - 10 / 5 * 6 / 3 + 100 / 2; System.out.println(number); The answer is 86.

    False

  • 42

    Solve this expression, is the answer correct? int answer; answer = 40 - 10 / 5 * 6 / 3 + 100 / 2; System.out.print(answer); The answer is 76.

    False

  • 43

    Is this a best practice and recommended code for declaration? int inputNumber;

    True

  • 44

    There are no errors in this code snippet. if(age >= 18) { System.out.print("Adult"); } else { System.out.print("Minor"); }

    True

  • 45

    Solve the expression, is the answer correct? double number; number = 50 + 10 / 5 * 6 / 2 + 100; System.out.println(number); The answer is 156.0

    True

  • 46

    Is this a best practice and recommended code for declaration of variable? int secondInput;

    True

  • 47

    Is this a best practice and recommended code for a class name? PrimeNumbers

    True

  • 48

    Is this a valid variable name? number1

    true

  • 49

    Is this line of code correct? System.out.println("I love Java\nprogramming.\n");

    true

  • 50

    Is this line of code correct? public Static void main(String[] args) { }

    False

  • 51

    int answer; answer = 30 - 20 / 10 / 3 + 100 / 2; System.out.println(answer); The answer is 80.

    True

  • 52

    Is this line of code correct? length = input.nextFloat();

    True

  • 53

    double answer; answer = 12 - 20 / 4 + 10 % 2 + 6 % 2 - 1; System.out.println(answer); The answer is 6.0double answer; answer = 12 - 20 / 4 + 10 % 2 + 6 % 2 - 1; System.out.println(answer); The answer is 6.0

    True

  • 54

    Is this line of code correct? if(console.hasNextDouble() == true):

    False

  • 55

    Is this a valid variable name? _option

    True