#include <iostream> using namespace std; int smallestIndex(int array[], int Size); int main() { const int SIZE = 15; int array[SIZE], i; for (int i = 0; i < SIZE; i++) { cout<<"Enter array["<<i<<"] : "; cin >> array[i] ; } smallestIndex(array, SIZE); cout << "TRead more
#include <iostream>using namespace std;int smallestIndex(int array[], int Size);int main(){const int SIZE = 15;int array[SIZE], i;for (int i = 0; i < SIZE; i++) {cout<<"Enter array["<<i<<"] : ";cin >> array[i] ;}smallestIndex(array, SIZE);cout << "The smallest index position is: " 5<< smallestIndex(array, SIZE) << endl;system("pause");return 0;}int smallestIndex(int array[], int Size){int smallest = 0, i;for (i = 0; i < Size; i++) {if (array[i] < array[smallest]) smallest = i;}return smallest;}
import java.util.*; public class LoanAccount{ // A static variable to store the annual Interest rate static double annualInterestRate; // A private variable of type double to store the principle amount private double principle; // Constructor of LoanAccount Class LoanAccount(double p){ principle = pRead more
import java.util.*;
public class LoanAccount{
// A static variable to store the annual Interest rate
static double annualInterestRate;
// A private variable of type double to store the principle amount
private double principle;
// Constructor of LoanAccount Class
LoanAccount(double p){
principle = p;
}
// The calculateMonthlyPayment() method computes the monthly payment
// Provided the number of payments to be made for a given principle amount
public double calculateMonthlyPayment(int numberOfPayments){
// The monthly interest rate is computed as annualInterestRate/12
double monthlyInterestRate = annualInterestRate/12;
// Here computing the value of monthly payments using the below formula
double monthlyPayment = principle * ((monthlyInterestRate)/(1 - Math.pow(1 + monthlyInterestRate, -1*numberOfPayments)));
// It returns the computed value of monthly payment
return monthlyPayment;
}
// Function to set the value of the annualInterestRate to a new rate
static void setAnnualInterestRate(double newRate){
annualInterestRate = newRate;
}
// Main Method
public static void main(String[] args){
// Created two instances of LoanAccount class with
// Principle amount of 5000 for loan1 and 31000 for loan2 LoanAccount loan1 = new LoanAccount(5000);
LoanAccount loan2 = new LoanAccount(31000);
// Test 1
// Setting annualInterestRate to 1% or 0.01 setAnnualInterestRate(0.01);
// Displaying the output in desired format
System.out.println("Monthly payments for loan1 of $5000.00 and loan2 of $31000.00 for 3, 5 and 6 year loans at 1% interest."); System.out.println("Loan\t3 years\t5 years\t6 years");
// Displaying the monthly payments of loan1 for the tenure for 36, 60 and 72 months
System.out.print("Loan1\t");
System.out.print(String.format("%.2f\t", loan1.calculateMonthlyPayment(36)));
System.out.print(String.format("%.2f\t", loan1.calculateMonthlyPayment(60)));
System.out.print(String.format("%.2f", loan1.calculateMonthlyPayment(72)));
// Displaying the monthly payments of loan2 for the tenure for 36, 60 and 72 months
System.out.print("\nLoan2\t");
System.out.print(String.format("%.2f\t", loan2.calculateMonthlyPayment(36)));
System.out.print(String.format("%.2f\t", loan2.calculateMonthlyPayment(60)));
System.out.print(String.format("%.2f", loan2.calculateMonthlyPayment(72)));
// Test 2
// Setting annualInterestRate to 5% or 0.05
setAnnualInterestRate(0.05);
// Displaying the output in desired format.
System.out.println("\n\nMonthly payments for loan1 of $5000.00 and loan2 of $31000.00 for 3, 5 and 6 years loan at 1% interest.");
System.out.println("Loan\t3 years\t5 years\t6 years");
// Displaying monthly payments for loan1 for the tenure for 36, 60 and 72 months
System.out.print("Loan1\t");
System.out.print(String.format("%.2f\t", loan1.calculateMonthlyPayment(36)));
System.out.print(String.format("%.2f\t", loan1.calculateMonthlyPayment(60)));
System.out.print(String.format("%.2f", loan1.calculateMonthlyPayment(72)));
System.out.print("\nLoan2\t");
// Displaying monthly payments for loan2 for the tenure for 36, 60 and 72 months
System.out.print(String.format("%.2f\t", loan2.calculateMonthlyPayment(36)));
System.out.print(String.format("%.2f\t", loan2.calculateMonthlyPayment(60)));
System.out.print(String.format("%.2f", loan2.calculateMonthlyPayment(72)));
}
}
RISC processors best illustrate the difference between architecture and implementation. To what extent is this statement true (or not true)? It is already stated that architecture and organization are orthogonal, i.e. they are independent. In principle, this statement is true. You can create an instRead more
RISC processors best illustrate the difference between architecture and implementation. To what extent is this statement true (or not true)?
It is already stated that architecture and organization are orthogonal, i.e. they are independent. In principle, this statement is true. You can create an instruction set on paper and then implement it any way you want, via direct logic (called random logic) or via a structure such as microprogramming.
However, some design or organization techniques may be suited or unsuited to a particular architecture. CISC processors are characterized by both complicated instructions (i.e., multiple-part instructions or instructions with complex addressing modes), for example, the BFFFO (locate the occurrence of the first bit set to 1) can be regarded as a complex instruction and irregular instruction encodings.
Consequently, CISC instruction sets are well-suited to implementation/interpretation via microcode. The instruction lookup table simply translates a machine code value into the location of the appropriate microcode. It doesn’t matter how odd the instruction encoding is.
RISC processors with simple instructions are well suited to implementation by pipelining because of the regularity of a pipeline, i.e. all instructions are executed in approximately the same way.
Q1.What does a first order predicate logic contain? Answer: Predicate and a subject Q2.At which state does the propositional literals are complementary? Answer: If one is the negation of the other Q3.Translate the following statement into FOL. “For every a, if a is a PhD student, thenRead more
Q1.What does a first order predicate logic contain?
Answer: Predicate and a subject
Q2.At which state does the propositional literals are complementary?
Answer: If one is the negation of the other
Q3.Translate the following statement into FOL.
“For every a, if a is a PhD student, then a has a master degree”
Answer: ∀ a PhD(a) -> Master(a)
Q4.Which of the following statements correctly define knowledge representation in AI?
Answer: All of the above
Q5.In AI systems, Knowledge can be represented in two ways. What are these two ways?
Answer: Predicate Logic , Propositional Logic
Q6.Which of the mentioned point are not valid with respect to a Propositional Logic?
Answer: Propositional Logic is a type of knowledge representation in AI
Q7.Consider the following statement:
“In the propositional logic system of knowledge representation, it is assumed that the word contains object, relations, and functions. The Predicate logic is a symbolized reasoning in which we can divide the sentence into a well-defined subject and predicate.”
By reading the above statement, State whether it is true or false?
Write a C++ function, smallestIndex, that takes as parameters an …
#include <iostream> using namespace std; int smallestIndex(int array[], int Size); int main() { const int SIZE = 15; int array[SIZE], i; for (int i = 0; i < SIZE; i++) { cout<<"Enter array["<<i<<"] : "; cin >> array[i] ; } smallestIndex(array, SIZE); cout << "TRead more
Loan Account Class: Create class LoanAccount. Use a static variable …
import java.util.*; public class LoanAccount{ // A static variable to store the annual Interest rate static double annualInterestRate; // A private variable of type double to store the principle amount private double principle; // Constructor of LoanAccount Class LoanAccount(double p){ principle = pRead more
RISC processors best illustrate the difference between architecture and implementation. To what extent is this statement true (or not true)?
RISC processors best illustrate the difference between architecture and implementation. To what extent is this statement true (or not true)? It is already stated that architecture and organization are orthogonal, i.e. they are independent. In principle, this statement is true. You can create an instRead more
RISC processors best illustrate the difference between architecture and implementation. To what extent is this statement true (or not true)?
It is already stated that architecture and organization are orthogonal, i.e. they are independent. In principle, this statement is true. You can create an instruction set on paper and then implement it any way you want, via direct logic (called random logic) or via a structure such as microprogramming.
However, some design or organization techniques may be suited or unsuited to a particular architecture. CISC processors are characterized by both complicated instructions (i.e., multiple-part instructions or instructions with complex addressing modes), for example, the BFFFO (locate the occurrence of the first bit set to 1) can be regarded as a complex instruction and irregular instruction encodings.
Consequently, CISC instruction sets are well-suited to implementation/interpretation via microcode. The instruction lookup table simply translates a machine code value into the location of the appropriate microcode. It doesn’t matter how odd the instruction encoding is.
RISC processors with simple instructions are well suited to implementation by pipelining because of the regularity of a pipeline, i.e. all instructions are executed in approximately the same way.
See lessSuppose you toss a coin 100 times and find that head occurs 72 times. You use maximum likelihood estimate to obtain P(H) to be p…
Correct option is (a.) p>q
Correct option is (a.) p>q
See lessWhich of the following sampling algorithms will ensure that no samples are discarded?
Correct options are (b.) Likelihood Sampling and (c.) Gibbs Sampling
Correct options are (b.) Likelihood Sampling and (c.) Gibbs Sampling
Q1.What does a first order predicate logic contain? Predicate and …
Q1.What does a first order predicate logic contain? Answer: Predicate and a subject Q2.At which state does the propositional literals are complementary? Answer: If one is the negation of the other Q3.Translate the following statement into FOL. “For every a, if a is a PhD student, thenRead more
Q1.What does a first order predicate logic contain?
Answer: Predicate and a subject
Q2.At which state does the propositional literals are complementary?
Answer: If one is the negation of the other
Q3.Translate the following statement into FOL.
“For every a, if a is a PhD student, then a has a master degree”
Answer: ∀ a PhD(a) -> Master(a)
Q4.Which of the following statements correctly define knowledge representation in AI?
Answer: All of the above
Q5.In AI systems, Knowledge can be represented in two ways. What are these two ways?
Answer: Predicate Logic , Propositional Logic
Q6.Which of the mentioned point are not valid with respect to a Propositional Logic?
Answer: Propositional Logic is a type of knowledge representation in AI
Q7.Consider the following statement:
“In the propositional logic system of knowledge representation, it is assumed that the word contains object, relations, and functions. The Predicate logic is a symbolized reasoning in which we can divide the sentence into a well-defined subject and predicate.”
By reading the above statement, State whether it is true or false?
Answer: False
See less