What is the value of total returned by the call secret(3) ? int secret int num) { int total= 10; switch(num) { case 1: case 2: total=5. break case 3. total= 10: case 4: total=total+3: case 8: total=total+6. break default: total=total+ 4. break} return total; }​

Answers

Answer 1

Answer:

19

Explanation:

Without break; statements, the switch "falls through" to the next case. So the code is directed to case 3, which sets total to 10. Then another 3 gets added and another 6, because cases 4 and 8 are also executed. That brings the total to 19.

So, always use a compile rule or code checker that checks your code for missing breaks, because it is hardly ever what you want on purpose.


Related Questions

Consider the following statements regarding computer programs A - Variables can contain different values at different times.B - Reserved words of a programming language can be used as variable names in that languageWhich of the following is true with respect to the above? * O Only A is correct Only B is correct Both A and B are incorrect Both A and B are correot​

Answers

Answer:

The answer is: Only A is correct.

Explanation:

Variables in a program can assume different values at different times, and the program can then produce different results, depending on circumstances, so A is correct.

In a computer language, a reserved word (also known as a reserved identifier) is a word that cannot be used as an identifier, such as the name of a variable, function, or label – it is "reserved from use". This is a syntactic definition, and a reserved word may have no meaning. So, B is incorrect.

Hence, the answer is: Only A is correct.

Predicting and controlling the social impact of technology, both anticipating new technologies and their social and environment implications and the consequences of ever- increasing scale of application of older technologies is one form of contribution of:


Select one:
A. Science to technology
B. Invention to innovation
C. Innovation to invention
D. Technology to science

Answers

Answer:

This report is a response to General Assembly resolution 72/242, in which the

Commission on Science and Technology for Development is requested, through the

Economic and Social Council, to give due consideration to the impact of key rapid

technological changes on the achievement of the Sustainable Development Goals. The report

contains analysis of the impact of rapid technological change on sustainable development,

especially the consequences for the 2030 Agenda for Sustainable Development’s central

principle of “leaving no one behind”. It presents the opportunities offered by rapid

technological change regarding the achievement and monitoring of the Sustainable

Development Goals across the various economic, social and environmental dimensions.

It discusses the transformative and disruptive potential of rapid technological changes,

including economic, social and normative considerations. In the report, it is highlighted that,

without appropriate science, technology and innovation policies, technologies, be they old

or new, are unlikely to deliver progress regarding global development. Such progress

requires an environment that nurtures learning and innovation to build and manage effective

innovation systems. In this context, the report presents examples of national strategies and

policies for rapid technological change and takes stock of regional, international and multistakeholder cooperation. In addition to national and international policies, the report also

calls for the international community to continue to discuss how international technology

assessment and foresight, as well as consensus building on normative guidelines, can shape

the developmental potential of rapid technological change. It concludes with suggestions for

Member States and the international community.

Explanation: