Ask C/C++ Expert


Home >> C/C++

1. Simplify the following

a)A && trueb)A || true
c)A || false
d)A && false

2. Convert to ORs using DeMorgan's Theorem

A && !B

3. Convert to ANDs using DeMorgan's Theorem

!(A||B||!C)

4. Simplify a&&(!b) || a&&b where a and b are boolean types.

5. In a boolean situation, what would be the opposite of the following expressions? Assume p is an integer type. USE ANATOMICALLY CORRECT JAVA SYNTAX.

a)(p > 9)
b)(r == 0)
c)(q >= s)

Use the following code in problems 6-9. Assume the Car class has already been created public class Tester
{
public static void main(StringI1 args)
{
double all= new double110001;
a121 = 19;
Car myCar = new Car(30); //sets mpg to 30 int tz = 46;
String s = "Pontotoc";
mcthodl(tz, a, myCar, s);
System.out.println (tz);
System.out.println(a121);
System.out.println(myCarempg);
Systenhout.println(s);
public static void methodl(int p, double glI, Car theCar, String str)
{
p = 800;
= -17.002;
thcCar.mpg = 25; str = "Field Creek";
}

6. What is printed by System.oraprintIn(tz); ?
7. What is printed by System.outprintln(aPp; ?
8. What is printed by System.omprintln(myCarmpg); ?
9. What is printed by System.outprintln(s); ?
10. Suppose the signature of a method is as follows:

private int bitWalker(int1111 x)
In the bit Valker method how would you determine how many rows are in the x army?
System.out.println( );

11. Using the signature from problem 7, show how you would determine from within the hitWalker
method how many columns are in this array. You may assume the array is perfectly rectangular and is not "ragged".

Systemout.println( );

12. Write code that will create a two dimensional array representing the following matrix. Use a for the object name.

12-20
-3472
6031

13. Using the array a[][] In you created in problem 9, what would be printed by the following code?

System.outprintln(a[2][1]);

14. What would be the result of running the following code?
int a[][] = new int[5][6];
a[1][2]=27;
a[1][3]=-11;
System.out.println(a[2][1]);

15. What is the effect of making a class abstract?

16. What is the effect of making a method abstract? Write the signature of abstract method anon4 that receives a two dimensional matrix and returns a boolean.

17. What is the effect of making a method final?

18. Name two ways you can make a method "invisible" to an inheriting class below it.

19. I create three objects from Vehicle, Car, Hybrid (in that order of hierarchy) named v1, c1, and h1 (respectively). What do the following statements print?

a)Systentout.println(v1 instanceof Car);
b)Systeni.out.println(h1 instanceof Car);
c)System.out.println(h1 instanceofIlybrid);
d)System.out.println(cl instanceof Vehicle);

20. Referring to the above, I create a method with the signature public void driveMe(Car temp).

a) Which of the following statements would be legal?

b) Fix any statements that are not legal

a) driveMe(v1);

b) driveMe(c1);

c) driveMe(h1);

21-24. Using pseudocode (i.e. it doesn't have to be legal JAVA), create three classes EnglishMusicians, RockBand, RollingStones. RockBand inherits EnglishMusicians, RollingStones inherit Rockband. For each one, create three method signatures (void, no parameters) that meet the following requirements:

a) One of EnglishMusicians' methods MUST be visible the whole way down the inheritance chain

b) A RollingStones object can use all three of its methods, two of Rockband's methods but only one of EnglishMusicians' methods.

25. Created two classes

public class Electron

{

public void charge1()
{

System.out.println("Charge1");

}

private void charge2()

{

System.out.println("Charge2");

}

public void charge3()

{

System.out.println("Charge3"),

}

}

public dass Quark extends Electron

{
public void charge3()

{

System.out.println("Flavor1");

}

public void charge4()

{

System.out.println("Flavor2");

}

public void charges()

{

System.out.println("Flavor3");

}

}

}

Explain what happens when I execute the folloing in a separate Tester class.

Electron sparky = new Quark();

sparky.charge2();

sparky.charge3();

sparky.charge5();

C/C++, Programming

  • Category:- C/C++
  • Reference No.:- M91352238
  • Price:- $70

Guranteed 36 Hours Delivery, In Price:- $70

Have any Question?


Related Questions in C/C++

Question 1find the minimum and maximum of a list of numbers

Question: 1. Find the Minimum and Maximum of a List of Numbers: 10 points File: find_min_max.cpp Write a program that reads some number of integers from the user and finds the minimum and maximum numbers in this list. Th ...

Software development fundamentals assignment 1 -details amp

Software Development Fundamentals Assignment 1 - Details & Problems - In this assignment, you are required to answer the short questions, identify error in the code, give output of the code and develop three C# Console P ...

What are the legal requirements with which websites must

What are the legal requirements with which websites must comply in order to meet the needs of persons with disabilities? Why is maximizing accessibility important to everyone?

There are several ways to calculate the pulse width of a

There are several ways to calculate the pulse width of a digital input signal. One method is to directly read the input pin and another method (more efficient) is to use a timer and pin change interrupt. Function startTi ...

Assignment word matchingwhats a six-letter word that has an

Assignment: Word Matching What's a six-letter word that has an e as its first, third, and fifth letter? Can you find an anagram of pine grave. Or how about a word that starts and ends with ant (other than ant itself, of ...

1 implement the binary search tree bst in c using the node

1. Implement the Binary Search Tree (BST) in C++, using the Node class template provided below. Please read the provided helper methods in class BST, especially for deleteValue(), make sure you get a fully understanding ...

Assign ment - genetic algorithmin this assignment you will

ASSIGN MENT - GENETIC ALGORITHM In this assignment, you will use your C programming skills to build a simple Genetic Algorithm. DESCRIPTION OF THE PROGRAM - CORE REQUIREMENTS - REQ1: Command-line arguments The user of yo ...

Project - space race part a console Project - Space Race Part A: Console Implementation

Project - Space Race Part A: Console Implementation INTRODUCTION This assignment aims to give you a real problem-solving experience, similar to what you might encounter in the workplace. You have been hired to complete a ...

Why do researcher drop the ewaste and where does it end

Why do researcher drop the ewaste and where does it end up?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As