Questions
I. Given the following code segment below what is the best description of line 5 and...

I. Given the following code segment below what is the best description of line 5 and line 6? Identify the public and private members.

1. #include <iostream.h>

2. class SimpleCat

3. {

4. public:

5. SimpleCat (int age, int weight);

6. ~SimpleCat(){}

7. int GetAge() {return itsAge;}

8. int GetWeight() {return itsWeight;}

9. private:

10. int itsAge;

11. int itsWeight;

12. };

II. Multiple Choice questions

1. A function that is called automatically each time an object is created or

instantiated is

a. constructor b. Destructor c. Copy constructor


2. A constructor may be _____________.

a. provided by you b. overloaded c. both a and b


3. A class named Gymnast must have this destructor.

a. Gymnast b. Destructor c. ~Gymnast d. *destructor


4. The return type for all constructors is this.

a. void b. int c. float d. double e. no type is allowed



5. A class named Building has a method getfloors( ). If School is a child class of Building and AMA is an object of type School then which of the following are valid?

a)Building.getfloors(); b)School.getfloors( ) c)AMA.getfloors();

III. What is the output ?

class A

{

int a,b,c;

public:

A( )

{

cout<<"A"<<endl;

}

~A( )

{

cout<<"B"<<endl;

}

void add( )

{

a=2, b=3;

c=a+b;

cout<<c<<endl;

}

};

void main()

{

A ab;

ab.add( );

}

In: Computer Science

USE C++: Encryption and Decryption are two cryptographic techniques. Encryption is used to transform text to...

USE C++: Encryption and Decryption are two cryptographic techniques. Encryption is used to transform text to meaningless characters, and decryption is used to transform meaningless characters into meaningful text. The algorithm that does the encryption is called a cipher. A simple encryption algorithm is Caesar cipher, which works as follows: replace each clear text letter with a letter chosen to be n places later in the alphabet. The number of places, n, is called the cipher key. For example, if the cipher key is 3, the clear text“HELLO THERE” becomes “KHOOR WKHUH”.Here, we restrict ourselves to encrypting/decrypting digits (0...9), lowercase, and uppercase alphabetic characters. As you know from the ASCII table, the set of these characters correspond to the integers 48to 122.Hint: The following formula can be used to encrypt a character C using the Caesar cipher algorithm: E = (C –‘0’ + k) % 75+ ‘0’ [where k is the cipher key]You need to figure out the formula for decrypting text on your own.NOTE: Use cipher key = 7.Write a C++ program for encrypting and decrypting a given string. Since this program performs two different functionalities (encryption and decryption), prompt the user to select the type of cryptographic technique as shown below: Welcome to Cryptographic Techniques ProgramPlease enter your selection:1. Encrypt2. DecryptWhen the user selects 1 or 2, s/he will be asked to specify an input and output message. Here is an example: Assume that the user enters the following message: HOW ARE YOU DOING? If the user selects to encrypt the message (i.e. option 1), the program will encrypt the original message and outputs an encrypted text. If the user selects to decrypt a message (i.e. option 2), the program will decrypt the encrypted text and outputs the decrypted text on the screen. The program should give the user the option of whether to continue with encrypting/decrypting messages (i.e. entering the letter ‘C’) or exit the program (i.e. entering the letter‘E’).

In: Computer Science

Visualize the initially empty myHeap after the following sequence of operations o myHeap.add(2) o myHeap.add(3) o...

Visualize the initially empty myHeap after the following sequence of operations
o myHeap.add(2)
o myHeap.add(3)
o myHeap.add(4)
o myHeap.add(1)
o myHeap.add(9)
o myHeap.remove()
o myHeap.add(7)
o myHeap.add(6)
o myHeap.remove()
o myHeap.add(5)

In: Computer Science

(Python) How would I add this input into my code? "Enter Y for Yes or N...

(Python) How would I add this input into my code? "Enter Y for Yes or N for No:" as a loop.

def getMat():
mat = np.zeros((3, 3))
print("Enter your first 3 by 3 matrix:")
for row in range(3):
li = [int(x) for x in input().split()]
mat[row,0] = li[0]
mat[row,1] = li[1]
mat[row,2] = li[2]
print("Your first 3 by 3 matrix is :")
for i in range(3):
for k in range(3):
print(str(int(mat[i][k]))+" ",end="")
print()
return mat

def checkEntry(inputValue):
try:
float(inputValue)
except ValueError:
return False
return True

print('Enter first matrix: ')
mat1 = getMat()

print('Enter second matrix: ')
mat2 = getMat()

print('Select a Matrix Operation from the list below:')
print('a. Addition')
choice = str(input())

while choice != 'e':
if choice == 'a':
print('You selected Addition. The results are: ')
res = mat1 + mat2

In: Computer Science

<Active Learning Literature Survey> How can the active learning strategy be applied to unsupervised learning and...

<Active Learning Literature Survey>

How can the active learning strategy be applied to unsupervised learning and what if the oracle is not perfectly correct? How does the paper suggest?

In: Computer Science

4. Using the switching algebra theorems minimize the following logic functions: a. F = WXYZ(WXYZ’ +...

4. Using the switching algebra theorems minimize the following logic functions:

a. F = WXYZ(WXYZ’ + WX’YZ + W’XYZ + WXY’Z)
b. F = XY + X’Y + YZ +Y’Z

c. F = A’C’ + A’BC + B’C
d. F = X + Y (Z + X + Z)

In: Computer Science

Differentiate between a Test Plan and a Use Case.                                   &

Differentiate between a Test Plan and a Use Case.                                                                  

In: Computer Science

Provide the optimal Solution to the problems below using java code and include Time Complexity Analysis!...

Provide the optimal Solution to the problems below using java code and include Time Complexity Analysis!

  1. Peaks and Valleys

In an Array of integers, a “peak” is an element which is greater than or equal to the adjacent integers and a “valley” is an element which is less than or equal to the adjacent integers. For example, the array {5, 8, 6, 2, 3, 4, 6}, {8, 6} are peaks and {5, 2} are valleys. Give an array of integers, sort the array into an alternating sequence of peaks and valleys.

EXAMPLE

INPUT:

                                {5, 3, 1, 2, 3}

                OUTPUT:

{5, 1, 3, 2, 3}

  1. Build Order

You are given a list of projects and a list of dependencies (Which is a list of pairs of projects, where the second project is dependent on the first project). All of a project’s dependencies must be built before the project is. Find a build order that will allow the projects to be built. If there is no valid build order, return an error.

EXAMPLE

                INPUT:

                                Projects: a, b, c, d, e, f

                                Dependencies: (a, d), (f ,b), (b, d), (f, a), (d, c)

                OUTPUT:

f, e, a, b, d, c

(I need java code with explanation of algorithms and time complexity)

In: Computer Science

Assume that you are given a task to design a system for a vehicular network (or...

Assume that you are given a task to design a system for a vehicular network (or any cloud computing system). Briefly discuss security requirements for such a system. Outline a security architecture that could achieve the specified security goals in the scenario. You must include in your discussion of the security limitations of your approach. Note that this is intended to be an open-ended problem and your alternative security architecture may or may not exist as a specific product or system, so you are expected to think creatively about this solution. It is likely that you will need to undertake some research to assist in answering this part of the problem.

Component marks

Discussion of security problems

• Who could be the potential adversaries?

• What could be the security requirements for the above system?

15%

Description of security architecture

• A system framework for the vehicular network or cloud computing system. Describe how the proposed system works.

• How to achieve the security requirements? Apply techniques you learned in this unit.

• Should be described with enough details to be understood and subject to a basic analysis.

35%

Analysis of limitations

• Unless your architecture is perfect, explain what its weaknesses are.

10%
Clarity and quality of writing, including organisation and evidence of research where necessary. 5%

In: Computer Science

There are 4 tables as shown below: Claims, defendants, Events and statuscodes. Claims: claim_id patient_name =====================...

There are 4 tables as shown below: Claims, defendants, Events and statuscodes.
Claims:
claim_id patient_name
=====================
10 'Smith'
20 'Jones'
30 'Brown'
Defendants
claim_id defendant_name
=======================
10 'Johnson'
10 'Meyer'
10 'Dow'
20 'Baker'
20 'Meyer'
30 'Johnson'
Events:
claim_id defendant_name claim_status change_date
==================================================
10 'Johnson' 'AP' '1994-01-01'
10 'Johnson' 'OR' '1994-02-01'
10 'Johnson' 'SF' '1994-03-01'
10 'Johnson' 'CL' '1994-04-01'
10 'Meyer' 'AP' '1994-01-01'
10 'Meyer' 'OR' '1994-02-01'10
10 'Meyer' 'SF' '1994-03-01'
10 'Dow' 'AP' '1994-01-01'
10 'Dow' 'OR' '1994-02-01'
20 'Meyer' 'AP' '1994-01-01'
20 'Meyer' 'OR' '1994-02-01'
20 'Baker' 'AP' '1994-01-01'
30 'Johnson' 'AP' '1994-01-01'
StatusCodes
claim_status claim_status_desc claim_seq
========================================
'AP' 'Awaiting review panel' 1
'OR' 'Panel opinion rendered' 2
'SF' 'Suit filed' 3
'CL' 'Closed' 4
The claim status of a defendant (with regard to a given claim) is his or her latest claim status, which is the claim status with the highest claim sequence number.
The claim status of a claim is the claim status of the defendant having the lowest claim status of all the defendants involved in the claim. This makes the claim status a minimum of the maximums. For this sample data, the answer would be:
claim_id patient_name claim_status
==================================
10 'Smith' 'OR'
20 'Jones' 'AP'
30 'Brown' 'AP'
The problem is to write a sql query to find the claim status of each claim and display it.

In: Computer Science

3) Consider the following IA32 assembly language code fragment. Assume that a, b and c are...

3) Consider the following IA32 assembly language code fragment. Assume that a, b and c are integer variables declared in the data segment.

                        movl    a, %eax
                        movl    b, %ebx
                        cmpl    %ebx, %eax
                        jge     L1
                        movl    %eax, %ecx
                        jmp     L2 
                L1:     movl    %ebx, %ecx
                L2:     movl    %ecx, c 

Write the C code which is equivalent to the above assembly language code. You don't need to include the variable declarations, a function or anything like that, just show the 1 to 4 lines of code in C that express what the above assembly code is doing:

In: Computer Science

An independent testing team is beneficial for test quality and comprehensiveness. Why?

An independent testing team is beneficial for test quality and comprehensiveness. Why?

In: Computer Science

C++ On linux Write a C++ program using the IPC. Declare two variables a=5 and b=6...

C++ On linux

Write a C++ program using the IPC. Declare two variables a=5 and b=6 in writer process. Now their product (a*b) will be communicated to the reader process along with your name. The reader process will now calculate the square root of the number and display it along with your name.

In: Computer Science

2) Draw a line between each of the IA32 assembler routines on the left and its...

2) Draw a line between each of the IA32 assembler routines on the left and its equivalent C function on the right. (If there is no matching C function, do not draw a line.):

        pushl   %ebp
        movl    %esp, %ebp
        movl    8(%ebp), %edx
        movl    12(%ebp), %eax
        cmpl    %edx, %eax
        jle     .L1
        movl    %edx, %eax
.L1:
        leave
        ret
        pushl   %ebp
        movl    %esp, %ebp
        movl    8(%ebp), %edx
        movl    (%edx), %edx
        movl    12(%ebp), %eax
        movl    (%eax), %eax
        cmpl    %edx, %eax
        jle     .L1
        movl    %edx, %eax
.L1:
        leave
        ret
        pushl   %ebp
        movl    %esp, %ebp
        movl    8(%ebp), %eax
        movl    12(%ebp), %edx
        cmpl    %edx, %eax
        jge     .L1
        subl    %edx, %eax
.L1:
        leave
        ret
        pushl   %ebp
        movl    %esp, %ebp
        movl    8(%ebp), %edx
        movl    12(%ebp), %eax
        cmpl    %edx, %eax
        jge     .L1
        movl    %edx, %eax
.L1:
        leave
        ret
int fun1(int a, int b)
{
   if (a < b)
      return a-b;
   else
      return a;
}



int fun2(int a, int b)
{
   if (a > b)
      return a;
   else
      return b;
}





int fun3(int *a, int *b)
{
   if (*a < *b)
      return *a;
   else
      return *b;
}



int fun4(int a, int b)
{
   if (a < b)
      return a;
   else
      return b;
}



(b) Consider the following IA32 assembly language code fragment:

       .data
       .align 4
A:     .long 10, 20, 30, 40, 50
       .text
main: <code>

Determine the decimal value stored in register %eax if <code> in the above code fragment is replaced by each of the following:

i) movl $A, %ebx
   movl 4(%ebx), %eax

ii) movl $2, %ecx
   movl A(,%ecx, 4), %eax

iii)  movl $24, %eax
   sarl $2, %eax

iv) movl $4, %ecx
   leal 4(%ecx,%ecx,4), %eax

In: Computer Science

OBJECT ORIENTED PROGRAMMING Design two grid based games or two block based games in c++ In...

OBJECT ORIENTED PROGRAMMING

Design two grid based games or two block based games in c++

In some cases, the bulk of the project lies in producing a nice user interface, probably using the FLTK graphical library, while the algorithmic content is quite simple. In other cases, the bulk of the work is in devising and implementing the algorithms. Some projects are more difficult than others, but a good policy is to choose one which allows extensibility if you have more time, or a suitable half-way stopping point if it proves to be difficult.

  1. Grid based games, ranging from the simple such as Noughts and Crosses through more complex games such as Minesweeper and Battleships. See Levy Computer Gamesmanship pp. 30-39
  2. Block based games, such as Snake or Tetris.
  3. You can design hangman, pong , tic tac toe

Tool: Dev++, Visual Studio or any of your choice.

In: Computer Science