Answer:
// here is code in C++.
#include <bits/stdc++.h>
using namespace std;
// recursive function to find sum from 1 to n
int recur_Sum(int n)
{ // base condition
if (n <= 1)
return n;
// recursive call
return n + recur_Sum(n - 1);
}
// main function
int main()
{
// variables
int n;
cout<<"Enter a number:";
// read the number
cin>>n;
// print the sum
cout<<"Sum of first "<<n<<" integer from 1 to "<<n<<" is:"<<recur_Sum(n);
return 0;
}
Explanation:
Read a number from user and assign it to variable "n".Call function recur_Sum() with parameter "n".This function will recursively call itself and find the Sum of first n numbers from 1 to n.Then function will return the sum.
Output:
Enter a number:10
Sum of first 10 integer from 1 to 10 is:55
Answer:
The answer is C) SQL Injection
Explanation:
Cross-Site Scripting (XSS) attacks are a type attacks that occur when an attacker uses a web application to send malicious code, generally in the form of a browser side script, to a different end user.
Cross-Site Request Forgery (CSRF) is a type of attacks specifically target state-changing requests, not theft of data, since the attacker has no way to see the response to the forged request.
SQL Injection is a type of cyber security attack where an attacker inputs a malicious input into an SQL statement., and the SQL server reads it as programming code.
Address Resolution Protocol poisoning (ARP poisoning) is a form of attack in which an attacker changes the Media Access Control (MAC) address and attacks an Ethernet LAN by changing the target computer's ARP cache with a forged ARP request and reply packets.
From the above brief definition; it is seen that the answer is C) SQL Injection.
Answer:
punctuation_chars = ["'", '"', ",", ".", "!", ":", ";", '#', '@']
def strip_punctuation(strWord):
for charPunct in punctuation_chars:
strWord = strWord.replace(charPunct, "")
return strWord
Explanation:
The function is defined with a single argument.
A for loop is ran to check each character of the the word.
If a punction mark is present as a character in the word, it is removed.
The same word is returned but without the punctuation marks.
Answer:
Opcode = 3
Mode =2
RegisterRegister =7
AR = 20
Explanation:
a) Number of addressing modes = 4 = 22 , So it needs 2 bits for 4 values
Number of registers = 65 = 1000001 in binary , So it needs 7 bits
AR = 20
Bits left for opcode = 32 -(2+7+20) = 3
A Uniform Resource Locator (URL)