Which of the following functions DOES NOT have a memory leak? Select one: void func(string word) { int* ptr = new int[2]; ptr[0] = word.size(); delete ptr; } void func(string word) { int* ptr = new int; *ptr = word.size(); } void func(string word) { int* ptr = NULL; int len = word.size(); ptr = &len; cout << "Length of " << word << " is " << *len << endl; }
Q: what is the output of the aes s box given the input 7e
A: Introduction: AES stands for Advanced Encryption Standard. It is a symmetric block cipher encryption…
Q: Keep in mind the relevance of wireless networks in third world countries. As compared to LANs and…
A: Families with many electronic devices, including PCs, laptops, and other mobile devices, are using…
Q: Two subroutines in a C# programme create a String object of a given size and a StringBuilder object…
A: Two subroutines in a C# programme create a String object of a given size and a StringBuilder…
Q: Throughput loss in wireless networks is substantially higher than that of wired networks. I am…
A: Introduction: Cabled network A network that uses physical wires and cables to link its computers is…
Q: Write in Assembly Language Programming show code and submit output screenshot 2. Write a program…
A: We have tp write a program in assembly language that ask the user to enter their month costs for…
Q: Can you explain in short why the scanf part is not correct
A: The scanf function is not working because, The scanf_s function expects an additional argument for…
Q: Select the characters that are literal characters: ? O a A 8 0!
A: In regular expressions, literal characters are characters that match themselves. They are not…
Q: What are the three sources of data for BI systems?
A: Introduction: Business Intelligence (BI) systems are software applications that are designed to…
Q: When a processor submits a request that can't be satisfied by the cache, and a block is being pushed…
A: When a processor submits a request that can't be satisfied by the cache in the operating system or…
Q: Many proposals have been made for a processor that can read and act on encrypted data and system…
A: The electrical apparatus that carries out computer-programmed instructions is what people call a…
Q: Describe a cassette drive and how it differs from a regular tape recorder that you would use to…
A: The term "cassette drive" refers to a typical tape recorder that may be used to store or load…
Q: To complete this assignment, please create a table comparing and contrasting the ethics of…
A: Ethics: A person's or group's moral code. Computer ethics: Applying morality to computer and…
Q: The use of an optical sensor to track mouse movements
A: Introduction mice that include an optical sensor to track mouse movements answer in below step.
Q: What exactly is meant by the term "wifi access point" when it is used in a sentence? Which purpose…
A: Introduction: Wi-Fi, or Wireless Fidelity, refers to a set of wireless networking standards that use…
Q: How can you ensure that your computer is safeguarded from the effects of abrupt voltage spikes?
A: SURGES IN POWER: A quick spike in voltage is called a power surge, often referred to as transient…
Q: A number of techniques exist for authenticating messages.
A: Introduction Authentication is the process of verifying the identity of an entity, such as a user,…
Q: In order for a network to operate, what are the three most important components? Just spare me a few…
A: Introduction of Computer Networking: Computer networking refers to the practice of linking multiple…
Q: Can an access point be compared to a hub or a switch in terms of the amount of data it can handle?…
A: An access point, hub, and switch are all networking devices used to connect multiple devices…
Q: According to the results of a super wing-ding diagnostic tool conducted on your personal computer,…
A: Introduction Diagnostic tool: A diagnostic tool is a software or hardware device that is designed to…
Q: How would you use firewall protection on your home network?
A: Per the query, Your home network is protected by a firewall. Make sure your router's network…
Q: Explore the use of Structured English and how it is describe to be processed in fields other than…
A: The use of structured English is a good strategy for decision analysis when method logic uses…
Q: downloads the latest first-person shooter (FPS) game all her friends are talking about. She starts…
A: Paola downloads the latest first-person shooter (FPS) game all her friends are talking about. She…
Q: Find out why wireless networking matters in third world nations. For what reasons do some…
A: Introduction: Some networks employ physical cabling. Wireless networks use electromagnetic radiation…
Q: If many subnets can be created on a single switch, and if users on separate subnets cannot interact…
A: While it's true that subnets on a single switch can be isolated from one another, virtual LANs…
Q: While using the web, how can we best safeguard our privacy?
A: Introduction: Safeguarding privacy on the web refers to the practice of protecting one's personal…
Q: there a distinction between logical caching and physical caching, and if so, what is it?
A: A CPU/central processing unit (processor) can access cache memory, a small form of volatile…
Q: To what end do you feel the need to have a dedicated IP address for your private network? Is it…
A: Having a dedicated IP address for a private network can be beneficial in several ways. One…
Q: How many of a computer's parts, both internal and external, get their power straight from the supply…
A: Information on how the power supply unit (PSU) works and which computer parts get their power…
Q: Can you explain why it's preferable to use asynchronous programming techniques rather than the more…
A: Asynchronous programming: Asynchronous programming is a technique that allows a program to execute…
Q: 5 If the value in EDX register is 805FD1C6, what is the value in DL? Anaswer (in hexadecimal) with…
A: In x86 architecture, the EDX register is a 32-bit register that is often used for holding the…
Q: Define parallel processing, which is synonymous with multiprocessing. This is a parallel processing.…
A: Your answer is given below.
Q: True or False ___(4) In a while loop, the body of the loop has to be executed at least once whether…
A: Introduction: In Java, a while loop is a control flow statement that continually runs code in…
Q: How does a system administrator pre-configure the public key of an SSH server? Which file is…
A: Secure Shell is a cryptographic organisation standard for securely accessing organisation advantages…
Q: Prove that independent set is NP-compete by proving that 3-COL ≤ poly Independent set. (Hint: A…
A: Np-complete graph: The concept of an NP-complete graph can be used to solve a wide range of…
Q: - manufacturer: String width: double height: double horizontalPixels: double -verticalPixels: double…
A: Java is a high-level, class-based, object-oriented programming language. It is used for developing a…
Q: Please provide three very good reasons why the spiral model is better than the waterfall method.
A: Software Development: Software development is the process of creating, designing, implementing, and…
Q: 37. Consider the following code segment and search method. (52,10,22,99,41,37,69,75,80); int[] list…
A: Please refer to the following steps for the complete solution to the problem above.
Q: In addition to defining the Iterative Waterfall Model, could you please guide me through its steps?…
A: Introduction: Software development models include iterative. With this paradigm, one step is…
Q: how to simplify: ac+b'c+a'c'd+bcd to get: ac+b'c'+a'bd
A: Introduction: Boolean algebra is a branch of algebra that deals with binary variables and logic…
Q: If you need to save passwords in a file, it's better to hash them than encrypt them for many…
A: Introduction: Encrypting passwords is safer than protecting them. The term is deceptive since you…
Q: Find out what makes the Rational Unified approach so innovative, and how it compares to the…
A: If you want to construct your own gaming computer, the first thing you need get is a power supply of…
Q: 4. Choose the correct segment of code that will allow the following POSTFIX program to accurate…
A: Postfix notation, also known as Reverse Polish Notation (RPN), is a way of writing expressions in…
Q: Testing at the unit level, the integration level, and the system level are all touched on. If so,…
A: Testing at the unit level, integration level, and system level are all important phases of software…
Q: What follows is a synopsis of the primary functions performed by an OS:
A: An operating system (OS) is a piece of software that functions as a bridge between computer hardware…
Q: Can the most significant distinctions between SMTP, POP3, and IMAP be summarized in terms of how…
A: Introduction: SMTP sends messages from the sender's email client to the receiver's email server and…
Q: When should I reload a service instead of restarting it?
A: A service should be reloaded when we want to reload the configuration of the service.
Q: 2.1-1 Using Figure 2.2 as a model, illustrate the operation of INSERTION-SORT on the array A (31,…
A: Insertion sort is a simple sorting algorithm that builds the final sorted array one item at a time…
Q: in java Write the Account class. The UML diagram of the class is represented below Requirements…
A: Algorithm: Define a class named "Account". Define private instance variables in the "Account"…
Q: Is it the hardware or the software if you power on a computer for the first time and there is no…
A: Introduction of Computer: A computer is an electronic device that can process and store information…
Q: Which of the follow match the regular expression: 'tar$' tar$ my_files.tar.gz Otar.gz Omy_files.tar
A: The string that matches the regular expression 'tar$' is option a: tar$. Explanation: The dollar…
Which of the following functions DOES NOT have a memory leak?
When programmers use the new keyword to acquire memory but fail to deallocate it using the delete() or delete[] operators, there is a memory leak.
Step by step
Solved in 2 steps
- The program will ask the user for their name and employee ID. The ID will be a five-digit number. This will be done in a single function, AskNameId, with bool return, where the name and id are passed as pointers. Read both variables as strings with a getline and convert the id to an int using atoi. Check that the id is not 0. If it is, cout a message to the user for entering an invalid id. Check if the name is an empty string. If it is, cout a message to the user for entering an invalid name. Return a bool, true if name and id are both valid and false if either one is not valid.Write a function encrypt that receives a message with a string or character vector and returns the message that is encrypted. This function returns the message concealed in the input string that is the first letter of each word in the string (or char vector) and returns a string that contains the first letter of each word in the input string. >> string = ‘This is the third question of final exam’; >> m = encrypt(string) m = ‘Tittqofe’ ( this question's program language is matlab )a) Write a c++ program which contains a function isPalindrome, the function checks a stringusing pointers whether it is a palindrome or not and based on the decision return Ture orFalse. A string/word that reads the same backwards as forward is known as palindrome.E-g MADAM , POP , BOB etcb) Write a program that takes a char array (char *) that take your name as input, a charpointer point it and convert lower to upper and vice versa.
- The following functions are all supposed to count how many times a certain base (represented as a character variable in Python) appears in a dna sequence (represented as a string variable in Python): def count1(dna, base): i = 0 for c in dna: if c == base: i += 1 return i def count2(dna, base): i = 0 for j in range(len(dna)): if dna[j] == base: i += 1 return i def count3(dna, base): match = [c == base for c in dna] return sum(match) def count4(dna, base): return dna.count(base) def count5(dna, base): return len([i for i in range(len(dna)) if dna[i] == base]) def count6(dna,base): return sum(c == base for c in dna) ======================================================================================= Which of them is correct? count 3, and count 6 only count 1, count 3, and count 4 only All of them are correct. count 1, count 3, count 4, and count 6 onlyThe following functions are all supposed to count how many times a certain base (represented as a character variable in Python) appears in a dna sequence (represented as a string variable in Python): def count1(dna, base): i = 0 for c in dna: if c == base: i += 1 return i def count2(dna, base): i = 0 for j in range(len(dna)): if dna[j] == base: i += 1 return i def count3(dna, base): match = [c == base for c in dna] return sum(match) def count4(dna, base): return dna.count(base) def count5(dna, base): return len([i for i in range(len(dna)) if dna[i] == base]) def count6(dna,base): return sum(c == base for c in dna) Which of the correct functions defined in the above exercise is the fastest? Hint. You will need to generate a very large string to test them on, and the function clock() from the time module to time each function. count2 count3 count5 count4The function “reverse” reverses a given string and returns a pointer to the resulting string. Complete the missing parts. char* reverse( char* str ) { int n, h, j, k; char _________________; n = strlen( _____________); h = (n / 2); for ( j=0, k=(n - 1); (j < h); j++, _____________________ ) { tmp = ___________; str[k] = str[j]; str[j] = _______________________________; } return ________________________;} int main( int argc, char** argv ) { char s[512]; strcpy( s, argv[1] ); printf( "Reverse: %s\n", reverse( s ) ); return 0;}
- 2. Caesar Cipher Create a function that takes two arguments (text, key) and returns a new encrypted text using the key. For example, if the input is "a" and the key is 1, it should move that letter 1 step in alphabetic order so the output would be "b". Examples: caesar_cipher("hello", 5) "mjqqt" caesar_cipher("hello world", 1)"ifmmp xpsme" caesar_cipher("a", 2)→ "c" Notes: The input is only letters and spaces; no special characters. What is Caesar cipher? Method in which each letter in the plaintext is replaced by a letter some fixed number of positions down the alphabet. The method is named after Julius Caesar, who used it in his private correspondence. Try it out yourself: https://cryptii.com/pipes/caesar-cipher = Python String Methods: https://www.w3schools.com/python/python_ref_string.aspIn Programming Exercise 13 (Chapter 8), you are asked to write a program to calculate students’ average test scores and their grades. Improve this programming exercise by adding a function to sort students’ names so that students’ data is output into ascending order according to their name. The code is below, is there a way to implement a sort function perhaps? Right now it just outputs as shown in the picture attached. #include <iostream> #include <fstream> #include <string> #include <iomanip> using namespace std; void getData(ifstream& inf, string n[], double tstData[][6], int count); void calculateAverage(double tstData[][6], int count); void calculateGrade(double tstData[][6], char gr[], int count); void print(string n[], double tstData[][6], char gr[], int count); int main() { string names[10]; double testData[10][6]; char grade[10]; ifstream inFile; inFile.open("data.txt"); if (!inFile) { cout…C++ is my answer correct ? Write a function to convert a given string : Answer: #include <iostream> #include <string> using namespace std; void toUpper(string &str) { for (int i = 0; i < str.length(); i++) { str[i] = toupper(str[i]); } } void toLower(string &str) { for (int i = 0; i < str.length(); i++) { str[i] = tolower(str[i]); } } int main() { string str = "khaled"; toUpper(str); cout << str << endl; str = "MOHAMMED"; toLower(str); cout << str << endl; return 0; } Write a function to calculate the sum of the even number from 1 - 100. Answer: #include <iostream> using namespace std; int sumEven() { int sum = 0; for (int i = 1; i <= 100; i++) { if (i % 2 == 0) { sum += i; } } return sum; } int main() { cout << sumEven() << endl; return 0; }
- The following functions are all intended to check whether a string representing a dna sequence contains any characters that are not 'a','c','g','t', 'A', 'C', 'G', or 'T'. At least some of these functions are wrong. Which ones are correct? A) def valid_dna1(dna): for c in dna: if c in 'acgtACGT': return True else: return False B) def valid_dna3(dna): for c in dna: flag = c in 'acgtACGT' return flag C) def valid_dna4(dna): for c in dna: if not c in 'acgtACGT': return False return True -------------------------------------------------------------------------------------------------------------------------------------------------------- valid_dna1 only valid_dna4 only None of them. valid_dna1, and valid_dna4 onlyUsing the code below, answer the following questions: 1) What are each of the 3 functions responsible for? 2) How many parameters will each function have? 3) What does each function return? 4) How will the program be controlled? 5) What functions will it call? 6) How will it communicate the results with the user? ********************************************* Code starts here ************************************************** Module.py #Defination to sort the list def sort(listNum): sortedList = [] #While loop will run until the listNum don't get null while(len(listNum) != 0 ): #Set the min as first element in list min = listNum[0] #iterate over the list to compare every element with num for ele in listNum: #If element is less than min if ele < min: #Then set min as element min = ele #append the sorted element in list sortedList.append(min) #Remove…(a) Write a C function readNums() that takes a filename and an integer array, reads the integer numbers in the file and stores into the array, returns the number of numbers stored in the array. Assume that the file only contains integer numbers, and nothing else. Prototype: int readNums(char filename[], int arr[]); (b) Write a C function delWordN() that takes a string and an integer (n) as parameter, removes from the string the words that are n character long. A word is a group of consecutive alphanumeric characters; words are separated by non-alphanumeric characters. ps: please do not copy paste from chegg or anywhere else. write unique code