True/False competency exam
True/False competency exam
The second part of the Key assignment is a competency test that will test your knowledge on fundamental data types, control structures, classes, objects, and methods.
- A Scanner class can be used to read in user input.
- Example syntax for creating a Scanner to read user input is:
Scanner input = new Scanner(“System.in”);
- The println() statement can be used to provide a prompt to the user.
- When using printf(), you can use %d as the format specifier for an int type.
- An import statement, such as the one to import java.util.Scanner should be the very last line in an application.
- You should always declare your instance variables as type public.
- Getters are used to set the value of private instance variables.
- Your application can use a getter to get the current value of an instance variable of an object that your application has created.
- You must always have an else part for every ‘ if’ statement.
- The following code will result in the code repeated while i is less than 5, causing the value of i to be printed out as 5.
int i = 0;
while (i<5);
{
i++;
}
System.out.printf(“%d”, i); - “for” loops can never result in an infinite loop.
- Pseudocode is helpful for algorithm development.
- Example syntax for a 3 argument constructor for a Book class that takes an int value, a double, and a String:public Book (int num1, double num2, String name) {
bookId = num1; bookPrice = num2;
title = name;
} - Example call to the Book constructor from an application could be:
Book myBook = new Book(“5”, “3.5”, “The Rabbit Ran”);
- A no argument default constructor will not be provided automatically by the Java compiler once you have declared your own constructor for a class.
- Constructors should always have a return type of ‘void’.
- The eight primitive Java types are: boolean, String, int, char, double, float, long, byte.
- A UML class diagram can be used to design your class.
- Relational operators can be used to create the condition for an “if” statement but never a “while” loop.
- In Java, && represents a Conditional AND operator.
"You need a similar assignment done from scratch? Our qualified writers will help you with a guaranteed AI-free & plagiarism-free A+ quality paper, Confidentiality, Timely delivery & Livechat/phone Support.
Discount Code: CIPD30
Click ORDER NOW..


