Answer:
See explaination
Explanation:
# Import required the module.
import random
# Define a function selector() which accepts the
# input_list, check_list, and return_list and
# returns a string named output.
def selector(input_list,check_list,return_list):
# Assign None to string variable output.
output=None
# Use for loop to traverse through input_list.
for i in range(len(input_list)):
# Check if element of an input_list is present
# in check_list.
if input_list[i] in check_list:
# Assign a random value from return_list
# to output.
output=random.choice(return_list)
# break out of the loop if input_list
# element is present in check_list.
break
#
return output
# Use assert statement to test a condition.
# If the condition is true, then program continues to
# execute, otherwise raises an AssertionError.
assert callable(selector)
assert selector(['is','in','of'],['of'], ['Yes']) == 'Yes'
assert selector(['is','in'],['of'], ['Yes','No']) == None
# Display the output.
print(selector(['is','in','of'],['of'], ['Yes']))
print(selector(['is','in'],['of'], ['Yes','No']))
The decimal number which is equivalent to binary number 11111011 is 251.
Binary numbers are base-2 numbers, which means they are composed of only two digits: 0 and 1.
Each digit in a binarynumber represents a power of 2, starting from the rightmost digit.
The rightmost digit represents 2⁰ (which is 1), the next digit represents 2¹(which is 2), the next represents 2² (which is 4), and so on.
Given the binary number 11111011:
1 × 2⁷ + 1 × 2⁶ + 1 × 2⁵ + 1 × 2⁴ + 1 × 2³ + 0 × 2² + 1 × 2¹ + 1 × 2⁰
Simplifying each term:
128 + 64 + 32 + 16 + 8 + 0 + 2 + 1
= 251
Hence, 251 is the decimalnumber which is equivalent to binary number 11111011.
To learn more on Binary numbers click here:
#SPJ3
Answer:
251
Explanation:
Answer:
// here is program in Java.
// import package
import java.util.*;
// class definition
class Main
{
// main method of the class
public static void main (String[] args) throws java.lang.Exception
{
try{
// variable
int gall;
double cost=0;
// object to read value from user
Scanner scr=new Scanner(System.in);
// ask user to enter type
System.out.print("Enter customer type (R for residential or B for business ):");
// read type of customer
char t=scr.next().charAt(0);
if(t=='r'||t=='R')
{
System.out.print("enter the number of gallons:");
//read number of gallons
gall=scr.nextInt();
// if number of gallons are less or equal to 6000
if(gall<=6000)
{
// calculate cost
cost=gall*0.007;
// print cost
System.out.println("total cost is: "+cost);
}
else
{
// calculate cost
cost=(6000*0.005)+((gall-6000)*0.007);
// print cost
System.out.println("total cost is: "+cost);
}
}
else if(t=='b'||t=='B')
{
System.out.print("enter the number of gallons:");
//read number of gallons
gall=scr.nextInt();
// if number of gallons are less or equal to 8000
if(gall<=8000)
{
// calculate cost
cost=gall*0.006;
// print cost
System.out.println("total cost is: "+cost);
}
else
{// calculate cost
cost=(8000*0.006)+((gall-8000)*0.008);
// print cost
System.out.println("total cost is: "+cost);
}
}
}catch(Exception ex){
return;}
}
}
Explanation:
Ask user to enter the type of customer and assign it to variable "t" with scanner object.If the customer type is business then read the number of gallons from user and assign it to variable "gall". Then calculate cost of gallons, if gallons are less or equal to 8000 then multiply it with 0.006.And if gallons are greater than 8000, cost for first 8000 will be multiply by 0.006 and for rest gallons multiply with 0.008.Similarly if customer type is residential then for first 6000 gallons cost will be multiply by 0.005 and for rest it will multiply by 0.007. Then print the cost.
Output:
Enter customer type (R for residential or B for business ):r
enter the number of gallons:8000
total cost is: 44.0
Answer:
Written in C++
#include<iostream>
using namespace std;
int main()
{
int N;
cout<<"Length of Array: ";
cin>>N;
int A[N], B[N];
for(int i =0;i<N;i++) {
cin>>A[i];
}
for(int i =0;i<N;i++) {
B[i] = A[i];
}
for(int i =0;i<N;i++) {
cout<<B[i]<<" ";
}
return 0;
}
Explanation:
This line declares the length of the Array; N
int N;
This line prompts user for length of array
cout<<"Length of Array: ";
This line gets user input for length of array
cin>>N;
This line declares array A and B
int A[N], B[N];
The following iteration gets input for Array A
for(int i =0;i<N;i++) {
cin>>A[i];
}
The following iteration gets copies element of Array A to Array B
for(int i =0;i<N;i++) {
B[i] = A[i];
}
The following iteration prints elements of Array B
for(int i =0;i<N;i++) {
cout<<B[i]<<" ";
}
{
privtae int num1;
private int num2;
/missing constructor /
}
The following statement appears in a method in a class other than Tester. It is intended t o create a new Tester object t with its attributes set to 10 and 20.
Tester t = new Tester(10,20);
Which can be used to replace / missing constructor / so that the object t is correctly created?
Answer:
Explanation:
The following constructor needs to be added to the code so that the object called t can be created correctly...
public Tester(int arg1, int arg2) {
num1 = arg1;
num2 = arg2;
}
This basic constructor will allow the object to be created correctly and will take the two arguments passed to the object and apply them to the private int variables in the class. The question does not state what exactly the Tester constructor is supposed to accomplish so this is the basic format of what it needs to do for the object to be created correctly.
B. Quantitative risk assessment
C. Qualitative assessment of risk
D. Business impact scoring
E. Threat modeling
Answer:
The correct answer to the following question is option B). Quantitative risk assessment.
Explanation:
QRA ( Quantitative Risk assessment) is the objective risk assessment tool that is used to project threat impacts.
Quantitative Risk Assessment provides the estimate of magnitude of the consequences for each of the identified budget threats.
It set out to measure, define, provide, and predict the confidence level of the likelihood and the occurrence of the threat impacts.
b. Computer simulations only run on very powerful computers that are not available to the general public.
c. Computer simulations usually make some simplifying assumptions about the real-world object or system being modeled.
Answer:
The answer is "Option c".
Explanation:
Computer simulation, use of a machine to simulate a system's vibration signals by another modeled system's behaviors. A simulator employs a computer program to generate a mathematical model or representation of a true system. It usually gives a lot of simplifications concerning the physical image or system that is modeled, so this statement describes the limitation of using a computer simulation in modeling a real-world object or process.