Give the value and the type of each expression

Assignment Help Basic Computer Science
Reference no: EM131014759

1. Assume that a program contains the following declarations:

char c = '\1'; short s = 2; int i = -3; long m = 5; float f = 6.5f; double d = 7.5;

Give the value and the type of each expression listed below.
(a) c * i (b) s + m (c) f / c (d) d / s (e) f - d (f) (int) f

2. The Hogwarts School was so happy with your math helper program that they referred you to a security firm! This security firm creates pin code door lockers like you see in the movies. They now need help to design an algorithm that will power the authentication system. The algorithm they want to validate codes is pretty weak, but it should work in the following way:

• It first checks if the pin code entered is four digits. If not, the code is invalid.

• It then checks if each digit within the four-digit pin is odd. If not, the code is invalid.

• If five consecutive invalid pins are entered, the system locks out and reports an intruder.

Therefore, codes 1234 and 357 are invalid because the former has even numbers (i.e., 2 and 4), and the latter is less than four digits. A valid pin code could be 1357 because it has exactly four digits. In addition, all of its four digits (i.e., 1, 3, 5, and 7) are odd.

(a) After creating a flowchart for the algorithm, save it as "l7 pin code.rap" and attach it to your online submission. The following shows an example of running the flowchart.

Enter pin code (attempt 1): 12 Code 12 is invalid!

Enter pin code (attempt 2): 1234 Code 1234 is invalid!

Enter pin code (attempt 3): 1375 Code 1375 is success!

The following shows another example:

Enter pin code (attempt 1): 12 Code 12 is invalid!

Enter pin code (attempt 2): 0999 Code 999 is invalid!

Enter pin code (attempt 3): 1278 Code 1278 is invalid!

Enter pin code (attempt 4): 1274 Code 1274 is invalid!

Enter pin code (attempt 5): 1272 Code 1272 is invalid!

Intruder alert!

Suggestion: Add a subchart CheckCode to help improving the readability of the flowchart

Reference no: EM131014759

Questions Cloud

Calculate the required rate of return : Calculate the required rate of return for Manning Enterprises assuming that investors expect a 4.5% rate of inflation in the future. The real risk-free rate is 1.5%, and the market risk premium is 3.5%. Manning has a beta of 2, and its realized rate ..
What practical effect would this have were your organization : Why is it important for Human Resource management to move from an operational and administrative role to a strategic role? What practical effect would this have were your organization (it can be a private sector company) to make this transition
Important concept in the capital budgeting process : What is opportunity cost and why is it an important concept in the capital budgeting process? The opportunity cost concept applies to almost every financial decision we make as individuals. Can you give an example from your own experience? What is th..
Theories of capital structure the cost of equity rises : In each of the theories of capital structure the cost of equity rises as the amount of debt increases. So why don't financial managers use as little debt as possible to keep the cost of equity down? After all, isn't the goal of the firm to maximize s..
Give the value and the type of each expression : The Hogwarts School was so happy with your math helper program that they referred you to a security firm! This security firm creates pin code door lockers like you see in the movies.
Alternative educational opportunities for students : Reports indicate that graduating seniors in a local high school have an average ( m ) reading comprehension score of 72.55 with a standard deviation (s ) of 12.62. As an instructor in a GED program that provides alternative educational op..
Estimate parameters of appropriate model for ge based data : Bismuth (a) and cadmium (b) form a eutectic at 144°C and xa 5 0.45. They are also completely immiscible in the solid phase. The melting points for bismuth and cadmium are 271°C and 321°C, respectively. The enthalpies of fusion of these elements a..
State an appropriate null hypothesis : State an appropriate null hypothesis. What is the value of the calculated test statistic ( Z )? State your conclusion.
A review of the ledger of carmel company at december : A review of the ledger of Carmel Company at December 31, 2014, produces the following data pertaining to the preparation of annual adjusting entries.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Formulate problem as linear programming problem

Formulate the following problem as a linear programming problem and then solve the problem by Excel only. Only the Excel file which shows the problem has been solved by Solver.

  Write an appropriate me expression capturing the essence

Write an appropriate ME expression capturing the essence

  Determine minimum number of element

We wish to find the element x that is in upper half when S is sorted, or in other words element which is greater than median. Determine the minimum number of element comparision required to solve problem ?

  Design an application that uses three identical arrays

Design an application that uses three identical arrays of at least 20 integers. It should call each module on a different array, and display the number of swaps made by each algorithm.

  Perform training needs analysis

In order to develop an effective training plan, we need to perform a Training Needs Analysis (TNA). What are the steps of a TNA? What role do users play in the process and what are some examples of elements of a final TNA output document.

  Describe not be able to perform without microsoft office

Assume that you did not have access to Microsoft Office or other compatible application suites. Describe at least three (3) tasks that you would not be able to perform without Microsoft Office 2013.

  Describe the difference between classes and objects

Please describe the difference between classes and objects. How are they related? What does it mean to instantiate an object? Also, please describe the difference between composition and aggregation and when it is better to use one over the other?

  Identify potential obstacles to wireless transmission

Describe the quality of service (QoS) assurance methods critical to converged networks, including RSVP and DiffServ.

  File sharing on a local network

File Sharing on a Local Network

  What is the length of values defined for city column

What is the length of values defined for city column. Modify the length of "city" in the table "suppliers".

  File managers used in different distributions of linux

There are three main types of file managers used in different distributions of Linux. Orthodox file managers or "Commander-like" file managers have three windows (two panels and one command line window).

  What is your all-time favorite linux-related website

What is your all-time favorite Linux-related website? Why is it your favorite (reference, utility, comic relief, etc.)?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd