Question
1. What would the output of the following Prolog query be? f(a,b) = f(X,Y). Select one: a. A=a. B=b. b. X=a. Y=b. c. This expression
1. What would the output of the following Prolog query be?
f(a,b) = f(X,Y).
Select one:
a. A=a. B=b.
b. X=a. Y=b.
c. This expression will generate an error.
2. Refer to the Java classes below: public class BankAccount { private double myBalance; public BankAccount() { myBalance = 0; } public BankAccount(double Balance) { myBalance = balance; } public void deposit (double amount) { myBalance += amount; } public double getBalance() { return myBalance; } } public class SavingsAccount extends BankAccount { private double myInterestRate; public SavingsAccount() { /* implementation not shown */ } public SavingsAccount(double balance, double rate) { /* implementation not shown */ } public void addInterest() { /* implementation not shown */ } } Which is a correct implementation of the constructor with parameters in the SavingsAccount class?
Select one:
a. myBalance = balance; myInterestRate = rate;
b. getBalance() = balance; myInterestRate = rate;
c. super(); myInterestRate = rate;
d. super(balance); myInterestRate = rate;
3. What output will the following perl code produce?
$barney = 56; $sum = 10 + $barney; print "Sum is $sum. ";
Answer: ....
4. Which option is the 2's complement of the following binary number:
00011100
Select one:
a. 11100100
b. 01111100
c. 10011100
d. None of these answers
5. The following code is an example of what functional programming language concept:
(f(x)+f(x))-f(x) is equivalent to 2(f(x))-f(x)
Select one:
a. referential transparency
b. polymorphism
c. the multiplicative property
d. type mapping
6. True/False: The type 2 hypervisor is designed to run directly on bare metal.
7. True/False: Subprograms that return a value are called procedures.
Select one:
True
False
8. Given the following perl code what will the output be?
@arr1 = (0,1,2,3,4); $, = ": "; # Change the separator again print (@arr1," ");
Select one:
a.
0: 1: 2: 3: 4:
b. 0 1 2 3 4
c. 0:
d. 0, 1, 2, 3, 4
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started