Differentiate between Spam and Trojan horse in context of networking and data communication threats.
A Trojan horse is a program that contains hidden malicious functions. Trojan Horses trick users into installing them by appearing to be legitimate programs. Once installed on a system, then start their side effects like destroying and stealing files.
The term spam means bombardment of email or unsolicited email to your email account. Most spam is commercial advertising. In addition to wasting people's time, spam also eats up a lot of network bandwidth.
Differentiate between URL and Domain name. Explain with help of a suitable example.
URL refer to Uniform Resource Locator which specifies the address of each resources on internet. e.g. URL https://www.onlinebooking.com/shop.html
the domain name system is a character-based naming database that translate domain name into numeric IP address
Differentiate between COUNT() and COUNT(*) functions in SQL with appropriate example.
Differentiate between fetchmany(), fetchone() and fetchall()
What is the difference between implicit type conversion and explicit type conversion?
Difference between actual and formal parameter
Parameters(arguments): information passed in a function during creation or calling is called parameters.
def sum(a,b):
s=a+b
print(s)
x=10
y=20
sum(x,y)
# a , b and x,y are called parameters.
Actual parameters: parameters passed in function calling. In above code x and y are actual parameters
Formal parameters: parameters passed in function definition. In above code a and b are formal parameters
Difference betwee call by reference and call by value in Python
When you pass arguments like whole numbers, strings or tuples to a function, the passing is like call-by-value because you can not change the value of the immutable objects being passed to the function.
Whereas passing mutable objects can be considered as call by reference because when their values are changed inside the function, then it will also be reflected outside the function.
# Python code to demonstrate call by value
string = "Hello"
def test(string):
string = "Bye"
print("Inside Function:", string)
# Driver's code
test(string)
print("Outside Function:", string)
Output
Inside Function: Bye
Outside Function: Hello
# Python code to demonstrate call by reference
def add_more(list):
list.append(50)
print("Inside Function", list)
# Driver's code
mylist = [10,20,30,40]
add_more(mylist)
print("Outside Function:", mylist)
Output
Inside Function [10, 20, 30, 40, 50]
Outside Function: [10, 20, 30, 40, 50]
What is the difference between implicit type conversion and explicit type conversion?
Difference between r+ and w+ file opening mode in python?
The r+ helps you read and write data onto an already existing file without truncating (Error if there is no such file).
The w+ mode on the other hand also allows reading and writing but it truncates the file (if no such file exists - a new file is created). If you are wondering how it is possible to read from a truncated file, the reading methods can be used to read the newly written file (or the empty file).
Difference between is and == operators in python
The == operator compares the value or equality of two objects, whereas the Python is operator checks whether two variables point to the same object in memory.