6. In the following Java code snippet, which variables are of primitive types, a
ID: 3731859 • Letter: 6
Question
6. In the following Java code snippet, which variables are of primitive types, and which variables are of reference types? double pi 3.14 ArrayList cint> numList-new Array List cint0 int i 3 Integer Integer(i) String Hello, _World 7. In Java, declare a variable that references to a two-dimensional double array and allocate space for the array 8. In Java, write a statement to check if an integer is even and if it is even, print out the message in the following form, Number 6 is even. when the number is 6. Note that number 6 is just an example 9. Assume there is a class AirConditioner that supports the following behaviors: turning the air conditioner on and off. The following methods are provide this behavior: turnOn and turnOff. Both methods take no arguments and return no value. Assume there is a reference variable myAC to an object of this class, which has already been created. Using the reference variable, invoke a method to tell the air conditioner object to turn off 10. Explain the difference between software verification and software validationExplanation / Answer
6]
A primitive type is predefined by the language and is named by a reserved keyword.
Primitive values do not share state with other primitive values.
The eight primitive data types supported by the Java programming language are :
Reference types are mostly designed to group primitive types together. So All other user defined data types are reference data type.
In given Java code snippet :
primitive types are :
double pi = 3.14;
int i = 3;
Reference types :
ArrayList <int> numList = new ArrayList <int> ();
Integer j = new Integer(i); //Here Integer is classes
String s = "Hello..World";
============================================================
7]
double[][] myList = new double[row size][column size];
e.g.
double[][] myList = new double[10][5];
Create 2D array of row 10 and column 5.
============================================================
8]
Let n is int variable holding input data from user.
int n;
.
.
.
if(n % 2 == 0)
{
System.out.println("Number "+n+" is Even ");
}
else
{
System.out.println("Number "+n+" is Odd ");
}
============================================================
9]
To access any public member functions of class use '.' operator.
Given, class AirConditioner contain two member function turnOn and turnOff.
myAc is reference variable object of class AirConditioner.
To access method turnOff use below code :
myAc.turnOff();
============================================================
10]
Software Verification :
Software verification is the process of evaluating and ensuring products of a development phase to find out whether they meet the specified requirements given by business team or clients.
In this we ensure that product being develop is as per given design specification and requirements.
Verification is carried out by Quality Analysis team to check whether implementation of software is as per given specification document/requirements or not.
Verification process involves below activities :
In this execution of code is never done, only output of software only check as per input.
Verification always carried out before validation.
Below items are evaluated during Verification:
Plans, Requirement Specifications, Design Specifications, Code, Test Cases etc,
Software Validation :
Software validation is the process of evaluating software at the end of the development process to determine whether software meets the customer expectations and requirements.
Here we ensure that software working as per given user’s requirements, and check whether the specifications were correct in the first place.
Validation of software are done by testing team.
Below Activities involve in validation :
Testing like black box testing, white box testing, gray box testing etc
Execution of code is done in this process, and this process also tell us that software is accepted by the user or not.
In this process main target are to find out bugs and errors in software and fixing.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.