Answer:
d.#include deque
Explanation:
We have to include deque library in order to use a deque container and the syntax to include is #include<deque>.Deque is a double ended queue which is a sequence container and allows operations of contraction and expansion on both ends of the queue.Double ended queues are a special case of simple queue since in simple queue the insertion is from rear end and deletion is from front end but in deque insertion and deletion is possible at both ends rear and front.
Decision variables reflectthe level of effectiveness of a system.
True
False
Answer: False
Explanation:
Decision variables does not reflect the level of effectiveness of a system as, decision variable are directly controlled by decision controller, and there are components that there value can be undetermined for the decision controller. All the mathematical equations defined the accurate relationship between the variable of the system and the measurement of the system effectiveness. Decision variables are basically referred as the basic objective and the constraints list.
Java provides a(n) ____ class, which contains many useful methods for manipulating arrays.
a.
Table
b.
Sort
c.
Arrays
d.
Object
Java presents Array Class, which contains many useful methods for manipulating "arrays".
It is essential because it introduces arrays and with that concept of "container variables".
Arrays are used everywhere.
Hope this helps.
r3t40
How would you copy all files from a remote directory into your LOCAL home folder.
Answer: Using secure copy 'SCP' we can copy all files from a remote directory into local folder. It also replaces existing files.
Explanation:
This is illustrated as follows:
scp -r username@IP:/path/to/server/source/folder/ .
-r is recursively copy all files
username is your username in your system
IP, here you cab specify the IP or type the website such as www.google.com
Then we specify the path, complete path
"." dot here refers the current directory. To copy the contents in the current directory.
A pentagonal number is defined as
(n(3n1))/2
for n = 1; 2; ::: and so on. So, the first few pentagonal numbers are 1; 5; 12; 22; :::
Write the following method that returns the nth pentagonal number:
public static int getPentagonalNumber( int n )
Answer:
public static int getPentagonalNumber( int n ){
//initialize the variable
int NthpentagonalNumber;
// use formula
NthpentagonalNumber = n*((3*n)-1)/2;
//return the result
return NthpentagonalNumber;
}
Explanation:
Create the function with return type int. it means, the function returns the integer value to the calling function.
In the function, we declare the one parameter with an integer type. so, it takes the value from the calling function.
then, initialize the variable for storing the output.
the formula for calculating the pentagonal number is:
[tex]pentagonal number = n*(3n-1)/2[/tex]
the value is passed by the user and the function capture the value in the parameter and then use the formula to store the output the variable.
and finally, return the output.
Given the following Preorder and Inorder traversals, please recover the original tree. Preorder: C F D G H A B E Inorder: G D H F C B E A
Answer:
To build the original tree follow the steps described below:
In Preorder traversal the root always comes first in the list, so C is the root. In Inorder traversal the nodes those are left to C will be in left sub-tree of C and the nodes those are right to C will be in the right sub-tree of C.Now, in the left sub-tree (G D H F) , F comes first in the Preorder traversal, so F is the root. And as G D H are left to F in Inorder list so, they will be in left sub-tree of F. In the right sub-tree of C, (B E A), A comes first in the Preorder list. So A is the root and B E will in left subtree of A.In left sub-tree of F, (G D H), D comes first in Preorder list, so D is the root and G is the left child of D and H is the right child of D.Among (B E), B comes first in Preorder list, so B is the root and as E is right to B in Inorder, so is the right child of BFor more follow the diagram:
Explanation:
Preorder traversal visits the root of the tree first then the left sub-tree and then the right subtree.
Inorder traversal visits the left subtree first then the root and then the right subtree.
The governor of New York that he has directed the state's Division of Criminal Justice Services to gather DNA from the broadest range of convicted criminals permitted under current law. This will result in the collection of as many as 40,000 DNA profiles. The additional DNA profiles may be obtained as a condition of release on parole or probation, as a condition of participation in the Department of Correctional Services' temporary release programs, and as a condition of a plea bargain. This _____ will be used for solving crimes.
database
network
mainframe
combination
conglomerate
Answer:
Database
Explanation:
Database.
The State’s DNA database is a database of DNA profiles that can be made public or private and can be used in the analysis of genetic fingerprinting for criminology. There are certain laws that come with how DNA databases are supposed to be handled.
Final answer:
The correct answer is "database". The additional DNA profiles directed by the New York governor will be added to a database and used for crime solving. This database, part of CODIS, facilitates forensic DNA analysis to match suspects with evidence, exonerate the innocent, and help solve crimes. The expansion of DNA collection in criminal justice raises important discussions regarding legal and privacy concerns.
Explanation:
The governor of New York has initiated an expansion of DNA collection to include the broadest range of convicted criminals allowed under current law, potentially adding up to 40,000 DNA profiles to the database. Such a database is crucial for the enhancement of law enforcement capabilities, allowing for the solving of crimes through forensic DNA analysis. This database is part of a larger system known as CODIS (Combined DNA Index System), which is maintained by the Federal Bureau of Investigation (FBI) and plays a vital role in criminal justice by matching DNA from crime scenes with potential suspects, exonerating the innocent, and providing leads in cold cases. The unique nature of DNA makes it an incredibly powerful tool, as the statistical power of discrimination from DNA analysis is profound, often making the probability of coincidental matches incredibly slim.
The use of DNA evidence in the legal justice system is not without its controversy, as questions around privacy and the extent of DNA collection arise. However, legal precedents such as State v. Franklin and U.S. v. Mitchell support the practice of taking DNA swabs even when individuals are only arrested, not convicted, under certain conditions. Additionally, the technology has proven beneficial, as evidenced by the work of the Innocence Project, which has used DNA fingerprinting to free wrongly accused individuals. DNA profiles in CODIS contribute to this by facilitating the identification of the true perpetrators and preventing miscarriages of justice.
Which Numpy function do you use to create an array? (Points : 1) np
np.array
np.numpy
numpy
Answer:
The correct option is np.array
Explanation:
Numpy is a library to perform numerical calculation in python. It allows us to create and modify vectors, and make operations on them easily. Numpy arrays are an excellent alternative to python lists. Some of the key advantages of numpy arrays are that they are fast, easy to work with, and offer users the opportunity to perform calculations through full arrays.
To start using numpy, the library must be imported:
import numpy as np
The most common way to create a vector or matrix already initialized is with the np.array function, which takes a list (or list of lists) as a parameter and returns a numpy matrix. The numpy arrays are static and homogeneous typing. They are more efficient in the use of memory.
Example:
list = [25,12,15,66,12.5]
v = np.array (list)
print (v)
Write a C++ programthat simulates a cash register. The user should keeptyping
in the prices of items andthe register must keep adding them up. When the user
types a 0, the registershould add up the prices of all the items, add 8% salestax,
and output the finaltotal. Example output is given below.
Enter the price of item 1: 5.00
Answer:
//C++ code for the cash register..
#include <iostream>
#include<vector> //including vector library
using namespace std;
int main() {
vector<float> cash; //declaring a vector of type float.
float item=2,cash_sum=0;
int counter=1;
while(item!=0)//inserting prices in the vector until user enters 0...
{
cout<<"Enter the price of item "<<counter<<" :"<<endl;
cin>>item;
counter++;
cash.push_back(item);//inserting element in the vector...
}
for(int i=0;i<cash.size();i++)//looping over the vector...
{
cash_sum+=cash[i];//summing each element..
}
cash_sum*=1.08;//adding 8% sales tax.
cout<<cash_sum;//printing the result....
return 0;
}
Explanation:
I have taken a vector of type float.
Inserting the price of each item in the vector until user enters 0.
Iterating over the vector for performing the sum operation.
Then after that adding 8% sales tax to the sum.
Printing the output at last.
Final answer:
A C++ program simulates a cash register by adding prices entered by the user, ending with a zero input to calculate and output the total with an added 8% sales tax.
Explanation:
The task is to create a C++ program that acts as a cash register, adding up the prices of items entered by the user. When the user enters a zero, the program calculates the total cost including an 8% sales tax and displays it. Below is an example of how this can be implemented:
#include
#include
using namespace std;
int main() {
double price, total = 0.0;
int count = 1;
cout << fixed << setprecision(2);
while (true) {
cout << "Enter the price of item " << count << ": ";
cin >> price;
if (price == 0) break;
total += price;
count++;
}
double salesTax = total * 0.08;
double finalTotal = total + salesTax;
cout << "Final total after tax: $" << finalTotal << endl;
return 0;
}
In this program, we use count to keep track of how many items have been entered and total to keep a running sum. The user is prompted for the price of each item, which is added to the total. If the user enters 0, the loop breaks, and the program calculates and outputs the final total, including the sales tax.
_________ variables are defined outside all functions and are accessible to any function
within their scope.
Answer:
Global Variables
Explanation:
A Global variable is a variable defined usually in the header that can be accessed by any part in a program.
However, this is not a good practice because anything in the program can modify the value of the variable; also, helps to get more difficult to read a code, due to the fact that you need to know where are those variables and where they have been modified.
Example en c++: Check that the final result its 10, it is not necessary to pass the variable as a parameter in functions
#include <iostream>
int varGlobal = 5; // this is the global variable
void ChangeVarGlobal()
{
varglobal=10; // reference to the variable
}
void main()
{
std::cout << global << '\n'; // reference to a variable in a second function
ChangeVarGlobal();
std::cout << global << '\n';
return 0;
}
A trust domain is defined as Select one: a. The agreed upon, trusted third party b. A scenario where one user needs to validate the other’s certificate c. A construct of systems, personnel, applications, protocols, technologies, and policies that work together to provide a certain level of protection d. A scenario in which the certificate’s issuer and subject fields hold the same information
Answer:
A construct of systems, personnel, applications, protocols, technologies, and policies that work together to provide a certain level of protection
Explanation:
Creation of dynamic Trust Domains can be realized through collaborative, secure sharing solutions. The local system is able to trust a domain to authenticate users. If an application or a user is authenticated by a trusted domain, all domains accept the authenticating domain. For instance, if a system trust domain X, it will also trust all domains that domain X trusts. It is a two-way trust relationship and is transitive.
Answer:
A construct of systems, personnel, applications, protocols, technologies and policies that work together to provide a certain level of protection
Explanation:
A trust domain is a certificate that entities or users gain and is granted by a trusted domain this is that when you enter another software or other systems you will be recognized as a trusted character or user and gives protection between systems and softwares and provides protection for the users.
Create your own unique Java application to read all data from the file echoing the data to standard output. After all data has been read, display how many data were read. For example, if 10 integers were read, the application should display all 10 integers and at the end of the output, print "10 data values were read"
Answer:
Output
The values read are:
25
3
4
65
7
9
5
6
1
11
10 data values were read
Explanation:
Below is the Java program to read all data from the file echoing the data to standard output and finally displaying how many data were read:-
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class MyFileReader {
public static void main(String[] args){
int num,counter=0;
File file=new File("numbers.txt");
try {
Scanner input=new Scanner(file);
System.out.println("The values read are: ");
while(input.hasNext()){
num=input.nextInt();
System.out.println(num);
counter+=1;
}
System.out.println(counter+" data values were read");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
True / False
Overflow is usually ignored in most computer systems.
Answer: True
Explanation: Overflow in computer system is a situation when there is the occurrence of error or disruption due to very large number that is given for calculation cannot be handled.So whenever the range of the particular number given by the user for calculation exceeds is termed as overflow error.It is usually avoided by the computer system because there is not much input given with large numbers for arithmetic operation or can be handled.
. Stress can affect not only your health, but also other aspectsof your
life. What else can be affected by stress?
a. Family relationships
b. Work performance
c. Your attention to safety
d. All of the given options
Answer:
d
Explanation:
all of this. all of this can happen due to stress
What are the two main functions of user accounts in Active Directory? (Choose all that apply.) Allow users to access resources method for user authentication to the network Provide detailed information about a user Provide auditing details
Answer:
method for user authentication to the network
Provide detailed information about a user
Explanation:
An in AD, a user account consists of all the information that includes user names, passwords, and groups. All these information defines a domain user in which a user account has membership access to. With the advanced features of Kerbos, mutual authentication in user accounts to a service is achieved.
Answer:
-Allow users to access resources
-Method for user authentication to the network
Explanation:
User accounts in Active Directory give people and programs the access to resources in a windows domain. These accounts are used to allow people to access resources, manage the access users have to resources like files and directories and allow programs to be able to run in a particular context. According to this, the answer is that the two main functions of user accounts in Active Directory are: allow users to access resources and method for user authentication to the network.
Which of the following does Moore's law predict?
a.The power of microprocessor technology doubles and its cost of production falls in half every 18 months.
b.The cost of microprocessors will increase as their power increases.
c.The price of microprocessors continues to fall, while their cost of production increases.
d.The demand for microprocessors continues to rise, while their supply falls.
e.The demand for microprocessor technology falls in half every 18 months.
Answer:
Hi!
The correct answer is the a.
Explanation:
The Moore's law is an a empirical law that Gordon Moore predicted doing some observations about how the density of the transistors on a integrated circuit was increasing over time.
For example, this law state that if you have an integrated circuit with: 1000 transistors in 1980 then in 1981 and six months later you will have the same integrated circuit with 2000 transistors, and so on..
Jan 1980: 1000 transistors.Jul 1981: 2000 transistors.Jan 1983: 4000 transistors.Jul 1984: 8000 transistors.And that's the reason because its cost will fall too.
A local variable that is declared as ____ causes the program to keep the variable and its latest value even when the function that declared it is through executing.
A) auto
B) static
C) extern
D) register
Answer:
A local variable that is declared as Static causes the program to keep the variable and its latest value even when the function that declared it is through executing.
True of False - use T or F An abstract class can have instances created using the constructor of the class.
Answer:
False
Explanation:
An instance of an abstract class cannot be created through the constructor of the class, because it does not have a complete implementation. Though, it is possible to have references of an abstract type class. Abstract classes are incomplete structures and you would have to build onto it before you are able to use it.
What is the output of the following code segment?
n = 1;
for ( ; n <= 5; )
cout << n << ' ';
n++;
1. 1 2 3 4 5
2. 1 1 1 ... and on forever
3. 2 3 4 5 6
4. 1 2 3 4
5. 2 3 4 5
Answer
1 2 3 4 5
Explanation:
initialize the value of n with 1
then, for loop is executed until the condition is true.
so, it check the condition 1<=5, condition true, code is executed and print 1
and n become 2.
again check condition 2<=5 condition true, code is executed and print 2
and n become 3.
and so on....
it print 1 2 3 4 5 after that check condition 6<=5 condition false, it terminate from loop.
Therefore, the answer is 1 2 3 4 5
electronic business includes which of the following
A. servicing customers
B. buying and selling
C. conducting electronic transactions within an organization
D all of these
Answer:
D. all of these
Explanation:
Electronic business includes : servicing customers, buying and selling , conducting electronic transactions within an organization.
Answer is all of these- D.
In doing a load of clothes, a clothes drier uses 18 A of current at 240 V for 59 min. A personal computer, in contrast, uses 3.0 A of current at 120 V. With the energy used by the clothes drier, how long (in hours) could you use this computer to "surf" the Internet?
Answer:
11.76 hours or 11 hours 45 minutes
Explanation:
Given
[tex]Current\ for\ drier = I_d = 18A\\Voltage\ for\ drier=V_d=240V\\Time\ for\ drier=t_d=59\ min[/tex]
We have to convert minutes into hours
So,
[tex]t=\frac{59}{60} = 0.98\ hours[/tex]
[tex]Current\ for\ Computer=I_c=3.0A\\Voltage\ for\ computer=V_c=120V[/tex]
As we are given that we have to find the time the computer will sustain using the same energy as the drier. So,
[tex]I_d*V_d*t_d=I_c*V_c*t_c\\18*240*0.98=3*120*t_c\\t_c*360=4233.6\\t_c=\frac{4233.6}{360}\\ t_c=11.76\ hours[/tex]
Converting into minutes will give us: 11 hours 45 minutes
Therefore, with the same energy used by the drier, the computer can be used 11.76 hours to surf the internet ..
Failing to include a complete ____ on each side of an && operator in an if statement is a common error in Java programming.
a.
operator
b.
mathematical expression
c.
variable
d.
Boolean expression
Answer:
Boolean expression
Explanation:
The operator '&&' is called AND operator. it provide the output base on the Boolean value on each side of AND operator.
it has four possible values:
First Boolean is TRUE and Boolean is TRUE, then result will be TRUE.
First Boolean is TRUE and Boolean is FALSE, then result will be FALSE.
First Boolean is FALSE and Boolean is TRUE, then result will be FALSE.
First Boolean is FALSE and Boolean is FALSE, then result will be FALSE.
Therefore, the correct option is Boolean expression.
The size of selcetor registor in protectedmode is
a.32 bits, b. 24 bits,c. 16 bit, d.none of these option
Answer: c) 16 bits
Explanation: Protected mode is the mode which works when the phase of CPU of an operating system which allows to use the virtual memory of the system. It is different from the real world mode and has the codes of 32 bit or 16 bits. For the protected mode ,the size the selector register becomes of 16 bits.When you enter any 16 bit value , it get into the selector register.
The true or false questions.
1.egrep can accept multiple filenames as input arguments.
Answer: True
Explanation: yes, it is true that egrep can accept multiple filenames as input arguments for example egrep -r "text1/text2", so this will search in all the sub directories . E grep is also known as 'grep -E' which belongs to the group of grep function and we used egrep to separate multiple patterns for OR conditions. This is also very less time consuming if you are going to search multiple input arguments in multiple different logs at the same time.
Write a function that converts a C-string into an integer. For example, given the string “1234” the function should return the integer 1234. If you do some research, you will find that there is a function named atoi and also the stringstream class that can do this conversion for you. However, in this program, do not use any predefined functions and you should write your own code to do the conversion. Use the function in your C++ program
_________ arguments are passed to parameters automatically if no argument is provided
in the function call.
Answer:
Default
Explanation:
When a Function is called, you pass a value to the parameter in function Call, and control is transferred to function definition. Parameters are optional that is, a function may contain no parameters.
Function definition contains the block of code to perform a specific task. Default arguments are passed to parameters in function definition if no argument is passed in function call.
Example: C program
#include <stdio.h>
int s(); //Function declaration
int main()
{
int n;
n = s(); //Function calling with no parameters
printf("\nSum = %d", n);
return 0;
}
int s() //Function definition
{
int c = 50, d = 80, s;
s = (c) + (d);
return s;
}
Output:
Sum=130
Write a function def countWords(stri ng) that returns a count of all words in the string string. Words are separated by spac For example, countWords ("Mary had a little lamb") should return 5.
Answer:
def w_count(s):
return(len(s.split()))
st=input('Enter a string:')
print("Number of words in given string=",w_count(st))
Explanation:
The code calculates and prints the sum of all the elements in the array a.
Int sum = 0;
For ( int I = 0; I < a.length; i++ )
{
//Your code goes here.
}
System .out.println( %u201Csum is %u201C + sum );
Answer:
public class sum{
public static void main(String []args){
int sum = 0;
int[] a = {9,2,8,4,0,6};
for ( int i = 0; i < a.length; i++ )
{
sum = sum + a[i];
}
System.out.println("The sum is: "+sum );
}
}
Explanation:
First create the class in java programming.
Then create the main function and declare the variable and array.
To calculate the sum of all element in array, first we have to traverse the array pick element one by one and then add,
so, we have to use loop for traversing and add with sum which inialize with zero.
suppose array element is 1,2,3,4
sum = sum +a[1] means sum = 0 +1=1
the sum = 1+2=3, sum = 3+4=7.
and then finally print the result store in sum.
. ............... package is used by compiler itself. So it does not need to be imported for use.
A) java.math
B) java.awt
C) java.applet
D) java.lang
Answer: The compiler automatically imports the java.lang package.
Explanation:
Java packages are defined as a collection of classes, interfaces, and the like. Java programs utilize the components in the packages to implement their functionalities. Packages are either imported by the compiler or by the user through import keyword. The user can import any package using the import keyword. The import statements are always written at the beginning of the program.
import java.math.* ;
For example, the programmer writes the above statement that imports the java.math package into the java program.
Default packages are automatically imported by the compiler.
Default packages include java.lang packages. This default package is made up of all the classes and functions that are mandatory to any java program. Without java.lang package, the java program cannot be compiled and hence, becomes useless. The Java compiler adds the import statement for the default package, java.lang, at the beginning of the compilation. Hence, the statement
import java.lang.*;
does not needs to be written in the program.
The java.lang package consists of useful components which are required for various operations that can be done on the datatypes found in Java language. This package consists of classes and functions which relates to each data type and defines the functions which can be utilized to perform the operations allowed for the respective data types.
The java.lang package consists of Object, String, Math, System, Thread, Exception classes and wrapper classes like Integer, Double etc.. All the operations that can be implemented on the above-mentioned data types utilize the functions defined in their respective classes.
For example, printing on the console is done using System class.
System.out.println();
Also, all the operations done on strings use the methods such as append(), insert(), delete(), and replace(), etc, are pre-defined in the String class in the java.lang package.
Without java.lang package, any Java program cannot be useful.
True of False - use T or F An interface is compiled into a separate bytecode file (.class).
Answer:
T
Explanation:
An interface is compiled to a separate bytecode class file.
For example of out application has a class myClass.java and an interface myInterface.java:
class myClass{
String name;
int age;
}
interface myInterface{
public String getName();
public int getAge();
}
Both of these are compiled to their own respective class files by the compiler,namely, myClass.class and myInterface.class.
Motivational appeals refer to
a- Values
b- Psychological needs
c- Emotions
d- All of thegiven options
Answer: D) All of the given options
Explanation:
Motivational appeals refers to the an emotional nature developed to increase individual values. It is a tool of emotions which target the psychological needs. It is a visualization of someone's desire and values and method of satisfying the emotions. Motivational appeals are divided into many categories like motivation and emotions.