1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vovikov84 [41]
3 years ago
5

Consider the following code segment. int[] seq = {3, 1, 8, 4, 2, 5}; for (int k = 1; k < seq.length; k++) { if (seq[k] >=

seq[0]) System.out.print(seq[k] + " " + k + " "); } What will be printed as a result of executing the code segment?
Computers and Technology
1 answer:
Setler79 [48]3 years ago
4 0

Answer:

This program will complete in 5 iterations,

initially

Seq[0]=3

Iteration 1:

loop starting from 1 and ends at 5 so

when  K=1,   then seq[1]=1

if seq[1]>=Seq[0]    ==>     1 is not greater than equal to 3

so "nothing to print because condition not true"

Iteration 2:

Now

K=2 so seq[2]=8

if seq[2]>=Seq[0]    ==>     8 is greater than equal to 3

so "condition is true" the output will be

output="8","2" means seq[k]=8 and K=2

Iteration 3:

Now

K=3 so seq[3]=4

if seq[3]>=Seq[0]    ==>     4 is greater than equal to 3

so "condition is true" the output will be

output="4","3"  means seq[k]=4 and K=3

Iteration 4:

Now

K=4 so seq[4]=2

if seq[4]>=Seq[0]    ==>     2 is not greater than equal to 3

so "condition is not true" the output will be

output=nothing

Iteration 5:

Now

K=5 so seq[5]=5

if seq[5]>=Seq[0]    ==>     5 is greater than equal to 3

so "condition is true" the output will be

output="5","5"    means seq[k]=5 and K=5

Explanation:

You might be interested in
Compare and contrast the following codes of ethics, including a listing of their similarities and differences: The ACM Code of E
lora16 [44]

Answer:

Please see the explanation

Explanation:

ACM professional code has following characteristics:

Genaral moral Imperative- This further consists of:

Contribute to society and human well being

Avoid harm to others

Be honest and trustworthy

Honor property rights including copyrights and patent

Respect the privacy of other

2) Professional responsibilities

Acquire and maintain professional coompetence

Achieve the highest quality

Accept and provide appropriate professional review

Respect the existing laws

Access computing and communication resources only when authorized to do so.

3) Organizational leadership

Articulate social responsibilities of members of an organizational unit and encourage full acceptance of those responsibilities.

Manage personnel and resources to design and build information systems that enhance the quality of working life.

Ensure that users and those who will be affected by a system have their needs clearly articulated during the assessment and design of requirements; later the system must be validated to meet requirements.

Create opportunities for members of the organization to learn the principles and limitations of computer systems.

4) Compliance with Code

Uphold and promote the principles of this Code.

Treat violations of this code as inconsistent with membership in the ACM.

Software Engineering Code of Ethics and Professional Practice

In accordance with their commitment to the health, safety and welfare of the public, software engineers shall adhere to the following Eight Principles:

Public: Software engineers shall act consistently with the public interest.

Client and Employer: Software engineers shall act in a manner that is in the best interests of their client and employer, consistent with the public interest.

Product: Software engineers shall ensure that their products and related modifications meet the highest professional standards possible.

Judgement: Software engineers shall maintain integrity and independence in their professional judgment.

Management: Software engineering managers and leaders shall subscribe to and promote an ethical approach to the management of software development and maintenance.

Profession: Software engineers shall advance the integrity and reputation of the profession consistent with the public interest.

Colleagues: Software engineers shall be fair to and supportive of their colleagues.

Self: Software engineers shall participate in lifelong learning regarding the practice of their profession and shall promote an ethical approach to the practice of the profession.

Australian Code of Professional Conduct

As an ACS member you must uphold and advance the honour, dignity and effectiveness of being a professional. This entails, in addition to being a good citizen and acting within the law, your conformance to the following ACS values.

1. The Primacy of the Public Interest

You will place the interests of the public above those of personal, business or sectional interests.

2. The Enhancement of Quality of Life

You will strive to enhance the quality of life of those affected by your work.

3. Honesty

You will be honest in your representation of skills, knowledge, services and products.

4. Competence

You will work competently and diligently for your stakeholders.

5. Professional Development

You will enhance your own professional development, and that of your staff.

6. Professionalism

You will enhance the integrity of the ACS and the respect of its members for each other.

In a situation of conflict between the values, The Primacy of the Public Interest takes precedence over the other values.

This Code of Professional Conduct is aimed specifically at you as an individual practitioner, and

is intended as a guideline for your acceptable professional conduct. It is applicable to all ACS

members regardless of their role or specific area of expertise in the ICT industry

All the three codes focus on the public interest, honestl, loyalty, ensuring quality of life, and professional development.

In Australian Code of conduct, in a situation of conflict between the values, The Primacy of the Public

Interest takes precedence over the other values, while there is no such thing in other two codes.

Software Engineering Code of Ethics and Professional Practice includes development of self, that is, Software engineers shall participate in lifelong learning regarding the practice of their profession and shall promote an ethical approach to the practice of the profession, which is not usually seen in other two codes.

8 0
3 years ago
How is social media changing the world as we know it?
Alisiya [41]

Answer:

Explanation:

Social media is making it easier to make a lot of noise about a pressing issue in society, such as human rights violations.

I use social media because I want to keep tabs on people I know.

A change in social media is that people have become increasingly overreliant on it. We tend to spend increasing amounts of time on social media.

Social media should be INFORMATIVE about presidential elections, and it should not be used to spread baseless information. This way, people are more informed about the facts of the candidates and their platforms.

Social media has paved the way for me to make new relationships to important people in my life.

Social media does pose a threat to family and leisure time when said family members tend to be overreliant on the phones and ignore those around them.

The person who is addicted to social media is myself because I spend several hours on it everyday— and that much interaction is too much because it should be one hour a day at most.

I have experienced cyberbullying; the solution to this problem is accountability and finding those who instigate it to bring them to justice.

3 0
3 years ago
_____ changes all occurrences of misspelled words in a document.
guajiro [1.7K]

Answer:

My answer is C.

4 0
3 years ago
I need help writing a recursion function to solve a boggle game for c++.
Mandarinka [93]

Answer:

#include <cstring>

#include <iostream>

using namespace std;

 

#define A 3

#define B 3

 

// LET US CREATE A DICTIONARY

string dict[] = { "KILLS", "GOT", "QUIZ", "GO" };

int n = sizeof(dict) / sizeof(dict[0]);

 

// Let us make a function to find whether a given word is present in dictionary.

bool isPresent(string& str)

{

   // linear search of words

   for (int i = 0; i < n; i++)

       if (str.compare(dict[i]) == 0)

           return true;

   return false;

}

 

// A function for printing all words present on Boggle

void findWordin(char bogle[A][B], bool hasbeenvisited[A][B], int i,

                  int j, string& str)

{

   hasbeenvisited[i][j] = true;

   str = str + bogle[i][j];

 

   // If str is in the dictionary, then you need to print it

   if (isPresent(str))

       cout << str << endl;

 

   // Travering adjacent 8 cells of the boggle

   for (int r = i - 1; r <= i + 1 && r < A; r++)

       for (int c= j - 1; c <= j + 1 && c < B; c++)

           if (r >= 0 && c >= 0 && !hasbeenvisited[r][c])

               findWordin(bogle, hasbeenvisited, r, c, str);

 

   // for erasing current characters on the string, and mark them visited

   // of the current cells to false  

   str.erase(str.length() - 1);

   hasbeenvisited[i][j] = false;

}

 

// Prints all words which are in dictionary.

void findWords(char boggle[A][B])

{

   // for marking all the characters as not being visited

   bool hasbeenvisited[A][B] = { { false } };

 

   // Initializing the present string

   string str = "";

 

   // Reading all the characters for finding all the words that begins with the above character

   for (int i = 0; i < A; i++)

       for (int j = 0; j < B; j++)

           findWordin(boggle, hasbeenvisited, i, j, str);

}

 

// the code for testing of the function

int main()

{

   char bogle[A][B] = { { 'k', 'I', 'L' },

                         { 'L', 'S', 'M' },

                         { 'G', 'O', 'T' } };

 

   cout << "Below list of words are present in the dictionary\n";

   findWords(bogle);

   return 0;

}

Explanation:

The program is properly commented, and that explains each step of it.  However, I have kept dictionary as constant for similifying the code. And it can be set to variable easily, if required.

7 0
3 years ago
The decision in an if statement is referred to as a
damaskus [11]
A selection because when you decide something you select
5 0
2 years ago
Read 2 more answers
Other questions:
  • A network using multiple cell towers falls under which type of network?
    13·1 answer
  • (True/False) Utilizing a higher bandwidth can support a larger volume of data (in bits per second) to be transmitted than a lowe
    13·2 answers
  • The OneDrive for Business application opens every time you start your program. You want to stop the program from automatically s
    15·1 answer
  • A group of students want to create an educational online game for computer laboratory in their school which type of network will
    6·1 answer
  • Assume that the following variables have been defined in a program: int x = 10; int y = 20; int z = 30; Write a cout statement t
    11·1 answer
  • Tikenya was responsible for creating the PowerPoint presentation for the group project. When it was complete, she wanted to emai
    12·2 answers
  • What led to fall of axum?
    15·2 answers
  • The meaning of belt drives
    10·1 answer
  • Write a simple algorithm in pseudocode that asks the user their favourite colour and then agrees with their choice, quoting the
    15·1 answer
  • Which of the following is NOT true about a USB stick?
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!