True or false, Python executes code line by line.
True
What is TCP and UDP?
TCP - Two way connection that only performs one cycle of network connection
UDP - One way connection that only perfroms one cycle of network connection.
What is recursion?
recusion is the idea of calling the function itself inside the function
What is duck typing?
If something quacks like a duck, walk like a duck, then it must be a duck.
Assert are test cases that make sure you are receiving the correct input or that your functions are working properly. Throws an error if the expected data is incorrect.
Try excepts are error handling so that your code never runs into an unhandled error.
what does if __name__ == "__main__" do?
What is an API?
An application programming interface is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build or use such a connection or interface is called an API specification.
What is the difference between recursion and iteration?
recursion uses function to loop through code.
iteration uses for or while to loop through code.
What are three types of testing?
Black white and grey.
What are the four namespaces and what happen after the four namespace.
Local, non-local(enclosing),global,built-in.
What is class in python? Name some characteristics of class and their purpose.
Class is a blueprint that creates objects in python. Abstraction and encapsulation are some characteristics of class.
What is sockets?
A network socket is a software structure within a network node of a computer network that serves as an endpoint for sending and receiving data across the network. The structure and properties of a socket are defined by an application programming interface for the networking architecture.
Fibonacci sequence.
What are the differences between unittest and integral test? When do you use these?
Integral test is to test multiple functions where one input depends on the output.
Name some external libraries/modules that we use for ICS 32.
requests, socket, pathlib
HTTP is a two way connection that works extremely similar to API. You give an url and expects a html webpage to be returned.
What does the following do:
def fib(a):
if a<=1:
return a
else:
return fib(a-1) + fib(a-2)
This is fibonacci sequence
use unittest.run() in main
def a():
global xx = 3
def b():
x=2
print(x)
a(x)b(x)
print(x)
5
3
Pass by reference
What are the two types of API? What are the differences between them?
bonus 100p answer:
two types of API are get and post. Get usually doesn't require a parameter within the request, Post usuall require a parameter within the request.
For example, you would request a class schedule for winter 2023 using a get request.
But you would want to use post to request an enrollment into a class.
What happens if you search "Recursion" on google.
What is edge/boundary case?
from pathlib import Path
p = Path().glob(“**/*.png”)