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
mr_godi [17]
3 years ago
6

Which is the best programming practice?

Computers and Technology
1 answer:
irina [24]3 years ago
4 0

Answer:

Open a file when the program needs to work with it and close the file as soon as you have finished using it.

Explanation:

In programming, we have some files that are stored in memory, or created in some other section of the program to save information.

<u><em>for example</em></u>, we want to save the data of a class or school faculty to create a database. For this purpose I need to create a file.

As the files that we will create may contains data, these files will utilize computer resources such as, memory (RAM, Cache) and other resources. While programming, we need these resources as well.

<em>Therefore, It is necessary to open a file when the program needs to work with it and close the file as soon as we have finished using it. The reason is that, it takes computer resources which are limited.    </em>

You might be interested in
Write a program having a concrete subclass that inherits three abstract methods from a superclass. Provide the following three i
hammer [34]

Answer:

C++

Explanation:

using namespace std;

class AbstractClass {

public:  

   virtual bool checkUpperCase(string inputString);

   virtual string lowerToUppercase(string inputString);

   virtual void stringToInt(string inputString);

};

class ConcreteClass: public AbstractClass {

public:

   bool checkUpperCase(string inputString) {

       bool isUpper = false;

       for (int i=0; i < strlen(inputString);  i++) {

           if (isupper(inputString[i])) {

               isUpper = true;

               break;

           }

       return isUpper;

      }

   string lowerToUppercase(string inputString) {

       for (int i=0; i < strlen(inputString);  i++) {

           putchar(toupper(inputString[i]));

       }

       return inputString;

   }

   void stringToInt(string inputString) {

       int convertedInteger = stoi(inputString);

       convertedInteger+=10;

       cout<<convertedInteger<<endl;

   }

};

int main() {

   ConcreteClass cc;

   return 0;

}

3 0
3 years ago
Which of the following is the java keyword used to declare a class
tekilochka [14]
Class is the java keyword used to declare a class
6 0
3 years ago
Reggie has hired you to design a home network. The home network will share a printer but will mainly be used to stream movies to
SIZIF [17.4K]

Answer:

i think the answer is a

Explanation:

3 0
3 years ago
Please use SQL to answer queries.
Vikentia [17]

Answer:

Please find the attachment of query:

Explanation:

IIn the given query multiple select clauses and where the condition is used which can be defined as follows:

In this query first, we select the "Dept" column from the "COURSE" table, and in where clause it uses another select clause in this clause it selects the "Course#" column from the "BOOK_ADOPTION" table.  

Inside this, another condition is used, that selects "Book_isbn" from the "TEXT" table and in where clause, it matches the publisher value that is "Addison-Wesley".        

6 0
4 years ago
Complete the following method named replaceEvens that receives the parameter numbers which is an array of integers. The method m
Taya2010 [7]

Answer:

Following are the method definition to this question:

public class Neg //defining class Neg

{  

public static void replaceEvens(int[] numbers) //defining a method replaceEvens that accepts array

{

int i; //defining integer variable

for(i = 0 ; i < numbers.length; i++) //defining foop to counts number

{

if(numbers[i]%2 == 0) //defining condition to check number is even  

{

numbers[i] = numbers[i] * -1; //multiply the number by -1

}

}

for(i = 0 ; i < numbers.length; i++) // defining loop print array

{

System.out.print(numbers[i] + " "); //print array

}

}    

public static void main(String[] as)//defining main method  

{

   int[] numbers = {12, 10, 18, 5, 2,22}; //defining array numbers and assign value

   System.out.println("Elements of array: "); //print message

   for(int i = 0 ; i < numbers.length ; i++)  //defining loop to print message

   {

   System.out.print(numbers[i] + " "); //print array

   }

  System.out.println("\n After replaceEvens"); //print message

   replaceEvens(numbers); //calling method replaceEvens

  }

}

Output:

please find the attachment.

Explanation:

  • In the given program a static method replaceEvens is declared, in which array numbers pass as the parameter, inside the for method loop is declared, which counts array number in this loop if block is defined, that check-in array there is an even number.
  • In the condition is true it will multiply the number by -1, and output side the loop it will define another loop to print its value.
  • Inside the main method, a number array is declared, that first prints its value then call the method to print its change value.    

3 0
3 years ago
Other questions:
  • _ are typically comprised of a mix of _ and _
    11·2 answers
  • Please help
    5·2 answers
  • Employees at a store are paid daily wages according to the following rules.
    6·1 answer
  • Which section in a slide is not visible to the viewers of a presentation, but is visible to the presenter in the normal Slide vi
    13·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    7·1 answer
  • In the code snippet, what is the “win” part called in programming?
    12·1 answer
  • Malware is a combination of which two words? A. malevolent and software B. malignant and software C. maladapted and software D.
    8·1 answer
  • Which three statements are true of lossless compression?
    6·1 answer
  • What does the digital living network alliance standardize
    12·1 answer
  • Write common ICT tools​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!