Answer: One occurrence of the object
Explanation:
The instance of the object is the one occurrence of an object in the given class. The common statement of an object with respect to the instance means that there is single occurrence of an object.
When the process run at each time it is known as instance of program given specific values and variables. An instance of the object is also known as class instance.
It is basically defined as specific realization in an object and also the object varies in different number of the ways in the object oriented programming (OOPs).
A(n) _____ of an class is where the services or behaviors of the class is defined. (Points : 6) operation
attribute
class
object
abstract class
Answer:
Operation the correct answer for the given question.
Explanation:
An operation is a template that is used as a template parameter .An operation defined the services and behaviors of the class .The operation is directly invoked on instance .
Attribute define the property of an entity it is not defined the services and behaviors of the class. so this option is incorrect.
Class is the class of variable of method it is not defined the services and behaviors of the class so this option is incorrect.
Object are the rub time entity .object are used access the property of a class it is not defined the services and behaviors of the class so this option is incorrect.
Abstract class is the class which have not full implementation of all the method .it is not defined the services and behaviors of the class so this option is incorrect.
So the correct answer is operation.
The answer to the question is the 'operation' of a class, where the behaviors or services are defined. Operations, also known as methods, are what allow objects of a class to perform actions and interact with other parts of a program. They are distinguished from attributes, which define a class's properties.
A operation of a class is where the services or behaviors of the class are defined. In object-oriented programming, a class is a blueprint for creating objects (a particular data structure), providing initial values for state (member variables or attributes), and implementations of behavior (member functions or methods, in other words, operations). The operations are essential to the functionality of a class as they enable the objects of that class to perform tasks and respond to messages.
Operations, which can also be referred to as methods or functions, define what actions can be performed on the data within an object. While attributes determine the properties and characteristics of a class instance, it is the operations that define how an instance of a class can interact with other parts of the program.
Consider a simple example of a class 'Car'. The attributes of the 'Car' class might include 'color', 'brand', and 'horsepower', but the operations might include 'startEngine()', 'stopEngine()', and 'accelerate()'. These operations are the behaviors that the 'Car' objects can exhibit.
Write a method with the signature "float sumArray(float[] data)" that takes an array of floats, and returns their sum.
Answer:
I will code in JAVA.
Preconditions:
The float array of data are declared and initialized.public float sumArray(float[] data) {
float sum = 0;
for(int i = 0; i < data.length; i++) {
sum = sum + data[i];
}
return sum;
}
Explanation:
First, you have to declare a variable sum of type float and initialize with 0. In addition, this method has a for-loop to go through whole array of data and each element is added to the float value to sum. When the for loop ends, the sum variable is returned.
Write Java code to implement the Euclidean algorithm for finding the greatest common factor of two positive integers.Must use recursion!
Answer:
/* here is code in java to find greatest common
divisor with Euclidean algorithm */
import java.util.*;
// class definition
class Main
{
// recursive method to find gcd
public static int Euclidean(int nm1, int nm2)
{
// base case
if (nm1 == 0)
return nm2;
// recursive call
return Euclidean(nm2 % nm1, nm1);
}
// driver method
public static void main (String[] args) throws java.lang.Exception
{
try{
// scanner object to read input
Scanner scr=new Scanner(System.in);
System.out.print("enter first number:");
// read first number
int n1=scr.nextInt();
System.out.print("enter second number:");
//read second number
int n2=scr.nextInt();
// call the method and print the gcd
System.out.println("greatest common factor of both number is: "+Euclidean(n1,n2));
}catch(Exception ex){
return;}
}
}
Explanation:
Read two number from user with scanner object and assign them to variables "n1" & "n2". Call the method Euclidean() with parameter "nm1"& "nm2".According to Euclidean algorithm, if we subtract smaller number from the larger one the gcd will not change.Keep subtracting the smaller one then we find the gcd of both the numbers.So the function Euclidean() will return the gcd of both the numbers.
Output:
enter first number:12
enter second number:39
greatest common factor of both number is: 3
Write a C program that prints the numbers from 1 to 100, but substitutes the word "fizz" if the number is evenly divisble by 3, and "buzz" if the number is divisible by 5, and if divisible by both prints "fizz buzz" like this: 13 1 14 2 fizz 4 buzz fizz 7 fizz buzz 16 17 fizz 8 fizz buzz 19 buzz ... 11 fizz and so on
Answer:
// here is code in C.
#include <stdio.h>
int main(void) {
int num;
// loop run 100 times
for(num=1;num<=100;num++)
{
//check divisibility by 3 and 5
if(num%15==0)
{
printf("fizz buzz ");
}
// check divisibility by 5 only
else if(num%5==0)
{
printf("buzz ");
}
// check divisibility by 3 only
else if(num%3==0)
{
printf("fizz ");
}
else{
printf("%d ",num);
}
}
return 0;
}
Explanation:
Run a for loop from 1 to 100. Check the divisibility of number by 15, if it is divisible print "fizz buzz", if it is not then Check the divisibility by 5 only.if it returns true then print "buzz". if not then check for 3 only,if returns true, print "fizz". else print the number only.
Output:
1 2 fizz 4 buzz fizz ........buzz fizz 97 98 fizz buzz
Your employer's right to electronically monitor you is an issue of ____.
consumer privacy
employee privacy
freedom of speech
online annoyances
Answer: Employee privacy
Explanation:
Employers can electronically monitor property, computer and electronic devices under the their rights in the organization but there is issue of employee privacy. As, employee has the right to privacy in the organization or workplace.
In some organization phones and email address are provided by the company so that they can electronically monitor the employee properly. In this case, some employee feel that monitoring is the violation of their personal and privacy rights.
What are the most important features to consider before purchasing a PC?
Answer: There are several features that should be considered before buying personal computer(PC).Some of the main factors are:-
Capacity of hard-drive is important to determine the storage space of the system so that it can hold data like files, videos , images etc as per the requirement.RAM(Random access memory) and processor of the personal computer is important for the fast processing and execution of the tasks and functionsSize of the personal computer should also be considered as main feature because compact size make it portable otherwise large sized PC are bulky.Brand is also a important feature because some PC and some other gadgets have already established popularity and reliability.Price point is also a must because there are all types of computer available in the market from low to high cost.But the PC should be according to the budget of individual .write a C program that declares an integer variable called "favorite_number". The program should then prompt the user to enter their favorite number, and use scanf to read the user's input into favorite_number. Finally, the program should print a message that includes the user's input.
Answer:
// here is code in C.
// headers
#include <stdio.h>
// main function
int main(void) {
// variable declaration
int favorite_number;
// ask user to enter favorite number
printf("enter your favorite number : ");
// read the number
scanf("%d",&favorite_number);
// print the message
printf("your favorite number is: %d",favorite_number);
return 0;
}
Explanation:
Declare a variable "favorite_number" of integer type.Ask user to enter favorite number and assign it to favorite_number.Then print the message which include the favorite number.
Output:
enter your favorite number : 77
your favorite number is: 77
#include <stdio.h>
int main() {
int favorite_number;
printf("Enter your favorite number: ");
scanf("%d", &favorite_number);
printf("The chosen number is %d.", favorite_number);
return 0;
}
DISPLAYEnter your favorite number: 19
The chosen number is 19.
EXPLANATIONDeclare the variable favorite_number as an integer type.
Using printf and scanf, ask the user to input their favorite number.
Print the number on the screen.
Return an integer value.
When on a LAN switch DHCP snooping is configured the networks that can be accessed by which clients?
Answer:
The network is accesible just for the whitelisted clients configured in the switch connected to the DHCP server
Explanation:
DHCP snooping main task is to prevent an unauthorized DHCP server from entering the our network.
Basically, in the switch we define the ports on which the traffic of the reliable DHCP server can travel. That is, we define as “trust” the ports where we have DHCP servers, DHCP relays and trunks between the switches.
What is character referencing and why is it used?
Answer: Character reference is the tool usually followed in the business world.It is defined as the recommendation that is provided by organization employee that has a relation with the candidate(individual) outside of the work. This also known as the personal reference. The candidate can be friend family or any other known person whose reference is being given.
This is used in the business field for revealing about the personality and character of the candidate apart from the skills and working abilities. It also helps in the hiring of the candidate easily when the description is good in the character reference.
Why is String final in Java?
Answer:
string objects are cached in string pool.
Explanation:
Strings in Java are immutable or final because the string objects are cached in String Pool.As we know multiple clients share the string literals so there exists a risk of one client's action affecting all other clients.
For ex:-The value of string is "Roast" and client changed it to "ROAST" so all other clients will see ROAST instead of Roast.
What would be the results of executing the following code? StringBuilder str = new StringBuilder("Little Jack Horner "); str.append("sat on the "); str.append("corner"); A. The program would crash. B. str would reference "Little Jack Horner ". C. str would reference "Little Jac Horner sat on the ". D. str would reference "Little Jack Horner sat on the corner".
Answer:
Correct answer is option(D) that is, str would reference "Little Jack Horner
sat on the corner".
Explanation:
StringBuilder are the objects which can be modified like strings object.It will first create a string builder and initialize with "Little Jack Horner".Then it will append string "sat on the " to initial string. In the last it will append string "corner" to the initial string.So in this way, str will have a string "Little Jack Horner sat on the corner ".
List at least three benefits of automated testing?
Answer:
Always available to run: You can run the tests 24/7, when you are at work, when you leave the office or if you working remote, you can run the test. They can be run virtually unattended, leaving the results to be monitored towards the end of the process.
Fewer human resources: You can reduce the people advocated on testing, you would need a QA automation to write your scripts to automate your tests, instead of people doing manual tests. In addition, once automated, the test library execution is faster and runs longer than manual testing.
Reusability and reliability: The scripts are reusable, a script could be used hundreds of times before need changes. It allows you to test exactly the same, without forgetting any steps this is why is more reliable and way quicker than manual test where people may cause.
What is ‘Black-Box’ testing?
Answer:
Black-box testing is the technique which is basically use to reduce the number of the possible cases of the test and also maintain the test coverage. This type of testing is used in the functional and the non functional requirement of the system.
It is type of testing that majorly focus on the functional requirement. There are many types of black box testing that are:
BVA (Boundary value analysis)Error guessingDecision table testing
Write a program to calculate the number of seconds since midnight. For example, suppose the time is 1:02:05 AM. Since there are 3600 seconds per hour and 60 seconds per minutes, it has been 3725 seconds since midnight (3600 * 1 + 2 * 60 + 5 = 3725). The program asks the user to enter 4 pieces of information: hour, minute, second, and AM/PM. The program will calculate and display the number of seconds since midnight. [Hint: be very careful when the hour is 12].
Answer:
// here is code in c++.
#include <bits/stdc++.h>
using namespace std;
int main()
{
// variables
int hour,min,sec,tot_sec;
string str,s="AM";
cout<<"enter number of hours:";
// read hour
cin>>hour;
cout<<"enter number of minutes:";
// read minute
cin>>min;
cout<<"enter number of seconds:";
// read seconds
cin>>sec;
cout<<"Enter AM or PM:";
// read AM or PM
cin>>str;
if((str.compare(s) == 0 )&& hour==12)
{
hour=0;
}
// calculate total seconds
tot_sec=hour*3600+min*60+sec;
// print the output
cout<<"total seconds since midnight is : "<<tot_sec<<endl;
return 0;
}
Explanation:
Read the value of hour, minute, second and string "AM" or "PM" from user.
Then if string is equal to "AM" then make hour=0.Then multiply hour with
3600, minute with 60 and add them with second.It will give the total seconds
from midnight.
Output:
enter number of hours:12
enter number of minutes:46
enter number of seconds:23
Enter AM or PM:AM
total seconds since midnight is: 2783
Final answer:
The program provided takes user input for hour, minute, second, and period (AM/PM) and calculates the total number of seconds since midnight. Special attention is given to the hour input to correctly adjust for 12-hour time format nuances, ensuring accurate conversion and calculation.
Explanation:
Calculating the number of seconds since midnight involves several steps of time conversion and careful consideration of whether the time is AM or PM, especially in the instance of 12 o'clock. Below is a simple program in Python which prompts the user for the required information and calculates the number of seconds since midnight:
Python Program:
def calculate_seconds(hour, minute, second, period):
if hour == 12:
hour = 0
if period.lower() == 'pm':
hour += 12
total_seconds = (hour * 3600) + (minute * 60) + second
return total_seconds
# User input
hour = int(input('Enter the hour: '))
minute = int(input('Enter the minutes: '))
second = int(input('Enter the seconds: '))
period = input('Enter AM or PM: ')
# Calculation
total_seconds_since_midnight = calculate_seconds(hour, minute, second, period)
print(f'It has been {total_seconds_since_midnight} seconds since midnight.')
This program will correctly convert the given time to the total seconds since midnight using the entered hour, minute, and second values, along with the period of the day.
A functional policy declares an organization's management direction for security in such specific functional areas as email, remote access, and Internet surfing.
True
False
Answer: True
Explanation:
Functional policies are referred to as a system or units of standardized procedures, processes and guidelines for employees which tends to state how exactly an employee has to provide services and commodities. The stages to go undergo this are usually formalized in organizations guide which usually will describe the respective processes. It also lies as the ground of franchising and thus tend to guarantee both the adherence to the process and the accomplishment of standards set .
Convert (123)5 to hexadecimal.
Answer:
[tex]26_{16}[/tex]
Explanation:
We can obtain the hexadecimal value using an indirected way, first we will convert it to decimal:
[tex](1*5^2+2*5^1+3*5^0)=38_{10}[/tex]
having the decimal number we have to divide that number multiple times by 16 and get a record of the quotient and reminder, until the quotient is equal to zero.
[tex]38| 16[/tex]
[tex]quotient_1=2\\remainder_1=6[/tex]
[tex]2| 16[/tex]
[tex]quotient_2=0\\remainder_2=2[/tex]
Now we will take the remainders and get the hexadecimal value and put them together. (remember, the hexadecimal number are defined from 0 to F, being A=10, B=11, C=12, D=13, E=14, F=15)
[tex]remainder_1=6\\hex_1=6[/tex]
[tex]remainder_2=2\\hex_2=2[/tex]
The hexadecimal number is 26
The first step in building a sequence diagram is to _____. (Points : 6) analyze the use case
identify which objects will participate
set the lifeline for each object
add the focus of control to each object's lifeline
Answer: Set the lifeline of each object
Explanation:
The sequence diagram is the efficient way that use in the system requirement document for the system design.
The sequence diagram is useful in many system that shows the interaction of the logic between the each object in the system.
The first step for building the sequence diagram is that set the lifeline of the each object in the system and it allow the main specification in the run time scenarios in the graphical manner. Therefore, it enhance the performance of the system.
What is a foreign key and how does it provide referential integrity?
Answer:
By definition a foreign key of table A is a primary key of another table B, thereby establishing a link between them.
To provide referential integrity you can use these referential actions:
Cascade: If rows in table B are deleted, the matching foreign key columns in table A are deleted. Set Null: If rows in table B are deleted, the matching foreign key columns in table A are set to null. Set Default: If rows in table B are deleted, the matching foreign key columns in table A are set with the default value of the column. Restrict: A value in table B cannot be deleted or updated while as it is referred to by a foreign key in table A.. The if statement regards an expression with a nonzero value as __________.
Answer: True
Explanation:
The given if statement respects to the expression with the worth 0 as 'False' and if the statement with the given expression that include a non-zero value is defined as True.
In an if/else proclamation, if the statement is executed then the expression is state as True and then the else part of the given statement is executed as "False".
When the given if statement is evaluated as true, then the inside code of the given block are set as -1 value.
How do you add Rulers to a document?: *
a. clck on View, then ruler
b.click on Insert, then Ruler
c. right click at the top of the document, then select Ruler
d. click on Design, then Ruler
Answer:
a. click on View, then ruler
Explanation:
If you want to add ruler to the document following is the procedure to do it:
Click on View.
Then check the ruler in the group called show.
You will get the ruler in your document.You can also remove it by unchecking the ruler box.
Ruler is used to measure and line up objects.
Hence the answer to this question is option A.
When we want to remove an element from an array, and have the removed element available for our usage, this is called.
pulling
discarding
appending
popping
Answer:
Popping.
Explanation:
When remove an element from an array and the element is available for our usage is called popping.pop() is a function in function in javascript arrays.The pop() function in javascript removes the last element from the array and return the value of the popped element so it is available for usage.
Hence the answer is popping.
Useful open source applications include the popular Web browser Mozilla Firefox, the e-mail application Thunderbird, the relational database management server MySQL, and the powerful programming language ____.
C++
PERL
XML
RPG
Answer:
C++
Explanation:
C ++ is an object-oriented programming language that takes the basis of the C language.
C ++ is a programming language designed in the mid-80s by Bjarne Stroustrup. The intention of its creation was to extend to the successful programming language C with mechanisms that allowed the manipulation of objects. In that sense, from the point of view of object-oriented languages, C ++ is a hybrid language. Subsequently, generic programming facilities were added, which added to the other two paradigms that were already admitted (structured programming and object-oriented programming). This is why it is often said that C ++ is a multiparadigma programming language.
At present, C ++ is a versatile, powerful and general language. His success among professional programmers has led him to occupy the first position as an application development tool. The C ++ maintains the advantages of the C in terms of operator wealth and expressions, flexibility, conciseness and efficiency. In addition, it has eliminated some of the difficulties and limitations of the original C.
Answer:
PERL
Explanation:
PERL (Practical Extraction and Report Language) :This is an Open Source software, that is licensed under its Artistic License, or the GNU General Public License (GPL).
Perl is a popular programming language that carries out a lot of functions and applicable in many applications, it was initially developed for just manipulation of text but is currently being used for a whole lot more, it used for a multiple tasks like web development and network programming.
The "A" in the CIA triad stands for "authenticity". True False
Answer: False, the "A" in the CIA triad stands for availability.
The CIA triad also know as the Confidentiality, integrity and availability triad, is known as a model which is designed in order to implement and enforce policies in regards to information security. This model is also referred as the availability, integrity and confidentiality model i.e AIC triad. This is done in order to avoid confusion with Central Intelligence Agency i.e. CIA.
. You have implemented file permissions on a file so that unauthorized persons cannot modify the file. Which of the following security goals has been fulfilled? A. Accountability B. Privacy C. Integrity D. Accountability
Answer: C)Integrity
Explanation: Integrity is the function that maintains the completeness and originality of information.It assures that the data is not manipulated or modified through any unauthorized access.This helps in keeping the system and data accurate.
Other options are incorrect because accountability is referred as the liability and privacy is only selected user can access the data but they can modify it.Thus, the correct option is option(c) .
Convert hexadecimal number 1AF2 to a decimal number.
Answer:
6898
Explanation:
Given that 1AF2 is a hexadecimal number.
We have in hexadecimal, the digits are 0,1,2,3...9, A,B,C,D,E,F for the 16 digits used.
Using the above we say in the given number, we have
2 in units column
F in 16 column
A in 16 square column
and 1 in 16 cube column
Place value[tex]= 2(1) +15(16)+10(16^2)+1(16^3)\\= 2+240+2560+4096\\=6898[/tex]
Hence 1AF2 = 6898 in decimal
By default, client DHCPv6 messages are sent using _____ scope. (Points : 3) the anycast address
router's prefix
the link-local
FF02::0A
None of the above
Answer: Router's prefix
Explanation: DHCPv6 (Dynamic host configuration protocol version 6) is the protocol used for an IPv6(Internet protocol version 6) network's host,prefixes,address and other such configurations.The prefix is used for sending the messages of DHCPv6 in the default situation.
In default situation the prefix acts as the cluster of the IP address and thus sends the the message to the destination using the address. Other options are incorrect because anycast address, local link and FF02::0A does not transmit the message in the default situation.Thus the correct option is router's prefix.
Write a program that asks the user to enter five different, integer numbers. The program then reports the largest number and the smallest number.
Use the if statement, but no loops.
Answer:
// here is code in C++.
#include <bits/stdc++.h>
using namespace std;
// main function
int main()
{
// variables
int minn=INT_MAX;
int maxx=INT_MIN;
int n1,n2,n3,n4,n5;
cout<<"enter five Numbers:";
//read 5 Numbers
cin>>n1>>n2>>n3>>n4>>n5;
// find maximum
if(n1>maxx)
maxx=n1;
if(n2>maxx)
maxx=n2;
if(n3>maxx)
maxx=n3;
if(n4>maxx)
maxx=n4;
if(n5>maxx)
maxx=n5;
// find minimum
if(n1<minn)
minn=n1;
if(n2<minn)
minn=n2;
if(n3<minn)
minn=n3;
if(n4<minn)
minn=n4;
if(n5<minn)
minn=n5;
// print maximum and minimum
cout<<"maximum of five numbers is: "<<maxx<<endl;
cout<<"minimum of five numbers is: "<<minn<<endl;
return 0;
}
Explanation:
Declare two variables "minn" & "maxx" and initialize them with INT_MAX and INT_MIN respectively.Then read the five number from user and compare it with "minn" & "maxx" ,if input is greater than "maxx" then update "maxx" or if input is less than "minn" then update the "minn". After all the inputs, "minn" will have smallest and "maxx" will have largest value.
enter five Numbers:5 78 43 55 12
maximum of five numbers is: 78
minimum of five numbers is: 5
In your opinion, what are the Pros and Cons of employers using Video Surveillance?
Answer: Video surveillance is the digital system used in the organization for the capturing of the video and storing it for monitoring .It is used for the security purpose of the business. The pros and cons of this system is mentioned as follows:-
Pros:
Providing security in business field Decrements in the crime rateProvides 24x7 monitoring and surveillanceServing real -time informationCons:
Costly investmentNeeds more devices for installation in large organizationsCreated privacy concernsOverloading of data storage in the form video can happen
Final answer:
Pros of employers using video surveillance include increased security and monitoring productivity. Cons include invasion of privacy and the potential for misuse by employers.
Explanation:
Pros:
Increased security: Video surveillance can help deter theft, vandalism, and other crimes in the workplace.Monitoring productivity: Employers can use video surveillance to ensure employees are working efficiently and following company guidelines.Evidence in legal matters: Video footage can serve as evidence in workplace disputes, accidents, or criminal activities.Cons:
Invasion of privacy: Video surveillance can infringe on employees' privacy rights and create a sense of constant monitoring.Potential for misuse: Employers may abuse video surveillance by using it for purposes other than security and surveillance.Employee morale: Constant video surveillance may create a negative work environment and lower employee morale.Explain what happens if you try to open a file for reading that does not exist.
Answer:
Exception is thrown and the file is created with 0 length.
Explanation:
While opening a file there is an error occur which shows the file does not exist that means an exception is thrown.
And this error can be occur when the size of the file is very very low means the file is a size of 0 length. So to avoid this error we have to exceed its length from the zero length.
An individual is first with the network before they are authorized to access resources on the network A. countermeasure B. vulnerability C. adversary D. risk
Answer:A) Countmeasure
Explanation: Countermeasure is the activity that is used for the reduction or avoidance of the threats or malfunction that occur in the operating system.The tool consists of the major components like firewalls , antiviruses etc to secure the system. It protects the servers, data systems , networks etc.
Other options are incorrect because vulnerability is the capability of a system being in exposed situation, adversary is a conflict situation and risk is the event that can cause loss in the operating system.Thus , the correct option is option(A) for checking the authorization of the individual and then only letting him access the network.