Download as pdf
Download as pdf
You are on page 1of 19
1. Explain about http, ftp, SMTP? HTTP stands for Hyper Text Transfer Protocol, FTP for File Transfer Protocol, while SMTP stands for Simple Mail Transfer Protocol. All three are used to transfer information over a computer network and are an integral part of today’s internet. HTTP is stateless. A Stateless protocol implies that the HTTP Web Server does not maintain which request had originated from which user. Hence, to give customized service to the user, HTTP uses Cookies. FTP is Out-of-band, as it uses a separate channel to send data (Data connection), as to send control information (Control connection). As SMTP is much older than HTTP. it restricts all its messages to be in 7-bit ASCII format. Whereas HTTP has no such restriction. HTTP encapsulates each file in a different HTTP message. Whereas, SMTP places all the contents of a mail in a single message. Hyper Text Transfer (HTTP) Protocol HTTP is used to access the data on the World Wide Web (www). It is is an application layer protocol. It is connectionless, media-independent, TCP/IP based, and stateless protocol. The HTTP protocol uses port 80 by default but it also can use other ports well. It transfers the data in the form of plain text, hypertext, audio, video, Html files, query results, etc. HTTP is similar to FTP in terms of transferring the files from one host to another host. But, HTTP is simpler than FTP because HTTP uses only one connection that is a data connection, in HTTP there is no control connection is used to transfer the files. HTTP is also similar to SMTP in terms of data transferred between the client and server. But, HTTP differs from SMTP in the way the messages are sent from the client to the server and from the server to the client. In HTTP messages are delivered immediately instead of stored and forward later happened in SMTP. It is further categorized as HTTP 1.0, HTTP Al leee2-O;and| Hilsis 0: File Transfer Protocol (FTP) FTP is an application layer protocol. It is used to exchange files over the internet and enables the users to upload and download the files from the internet. It transfers both text and binary files over the Internet. But mainly used for transferring the web page files from their creator to the computer that acts as a server for other computers on the internet. It transfers the data more reliably and efficiently. FTP uses TCP at the transport layer. FTP is a connection-oriented protocol. FTP is an out-of-band protocol as data and control information flow over different connections. FTP creates two connections between the computers one connection for the commands and replies called control connection and a second connection for data transfers called data connection. FTP uses Port number 21 for the control connection and Port number 20 for the data connection FTP is built on a client-server model architecture using the control connection and data connection between the client and server. Simple Mail Transfer Protocol (SMTP) SMTP is mainly used for sending emails efficiently and reliably over the internet. SMTP is a push protocol and uses TCP at the transport layer. SMTP uses persistent TCP connections, so it can send multiple emails at once. SMTP is a connection-oriented, stateless, and in-band protocol. SMTP uses port number 25. SMTP is a general set of interaction guidelines that allow the software to transmit electronic mail over the internet. It set up communication rules between servers and allows the exchange of emails between the users on the same or different computers. SMTP is a pure text-based protocol. It can only handle the messages containing 7 bit ASCII text and can not transfer other types of data like images, video, audio, etc. SMTP can not transfer executable files and binary objects. MIME extends the limited capabilities of email. It enables the users to send and receive graphics, audio files, video files, etc in the message.MIME was specially designed for SMTP. Sometimes SMTP Auth stands for SMTP Authentication has been provided for authentication purposes. 2. Explain about angular JS form validation ? AngularJS Form Validation AngularJS performs form validation on the client side. AngularJS monitors the state of the form and input fields (input, text-area, select), and notify the user about the current state. AngularJS also holds information about whether the input fields have been touched, modified, or not. Form input fields have the following states: $untouched: It shows that field has not been touched yet. $touched: It shows that field has been touched. $pristine: It represents that the field has not been modified yet. $dirty: It illustrates that the field has been modified. $invalid: It specifies that the field content is not valid. $valid: It specifies that the field content is valid. These all are the properties of the input field which can be either true or false. Forms have the following states: $pristine: It represents that the fields have not been modified yet. $dirty: It illustrates that one or more fields have been modified. $invalid: It specifies that the form content is not valid. $valid: It specifies that the form content is valid. $submitted: It specifies that the form is submitted. These all are the properties of the form which can be either true or false. These states can be used to show meaningful messages to the user. Custom validation: To create your own validation function add a new directive to your application, and deal with the validation inside a function with certain specified arguments. AngularJS stores the data of changes in the input field. Let's have a look at the states of form input fields. States Description $valid It indicates that the field's content is valid. $invalid It indicates that the field's content is not valid. $dirty It shows that the field is modified. $pristine It shows that the field is not modified yet. $touched It indicates that the field is touched. $untouched It indicates that the field is not touched. $submitted It indicates that the form has been submitted. 3. Explain Dom and SAX parser ? There are two types of XML parsers namely Simple API for XML and Document Object Model. SAX DOM SAX (Simple API for XML), is the most widely adopted API for XML in Java and is considered the de-facto standard. Although it started as a library exclusive to Java, it is now a well-known API distributed over a variety of programming languages. It is an open-source project and has recently switched to SourceForge project infrastructure that makes it easier to track open SAX issues outside the high-volume XML-~dev list. The current latest version as of 01/10/2018 is SAX 2.0. It uses an event- driven serial-access mechanism for accessing XML documents and is frequently used by applets that need to access XML documents because it is the fastest and least memory-consuming API available for parsing XML documents. The mechanism SAX uses makes it independent of the elements that came before, i.e. it is state- independent. DOM stands for Document Object Model. The DOM API provides the classes to read and write an XML file. DOM reads an entire document. It is useful when reading small to medium size XML files. It is a tree-based parser and a little slow when compared to SAX and occupies more space when loaded into memory. We can insert and delete nodes using the DOM API. e DOM API is easy to use so that we can do both write and read operations. e When a document is required then it preferred a wide part that can be randomly accessed. Disadvantages Of DOM Parser e Its efficiency of memory is not too good, it takes more memory cause XML docs needed to load in there. e In comparison to the SAX parser, it is too slow Both DOM and SAX have their advantages and disadvantages when it comes to parsing XML documents. DOM is suitable for smaller XML documents where random access and easy manipulation of the XML structure are required. On the other hand, SAX is more appropriate for large XML documents where memory usage and parsing speed are crucial. 4. Explain about pattern matching reguler expressions ? The process of algorithmically searching for patterns in sequences of unprocessed data or tokens is called pattern matching. This job is limited to finding precise matches within a pre existing database and cannot create new patterns. Contrary to popular belief, pattern matching is not a deep learning method but rather a fundamental approach for testing and validating code and data. How does a match pattern work? Any string, not only discrete variables, may be used as a pattern in pattern matching since it is simply filtering and/or replacing data. How exactly patterns are discovered changes based on the data being examined. Instead of doing a full, “brute force” search of all the data, most instances verify and match regular expressions or tree patterns (strings) via a process-of-elimination strategy, like backtracking. Regular expressions are used in pattern matching algorithms (or regex). You might think of a regular expression as a language that allows you to establish a pattern and communicate it to another person (or in this example, a computer program). With the use of regular expressions, testing data may be analyzed for specific patterns. Regular expressions (regexps) may be automatically generated by certain programs if they are smart enough to recognize patterns in a given collection of data values. Common regular expressions such as those for credit card numbers, phone numbers in the United States, date/time formats, and email addresses may already be included in certain applications and tools. Match patterns There are many ways to match patterns in different programming languages. Here are a few examples: Regular expressions. Many programming languages support the use of regular expressions, a sequence of characters that define a search pattern. Regular expressions can be used to search for patterns in strings, and to perform operations such as search and replace based on those patterns. String methods. Many programming languages have built-in string methods that can be used to search for patterns within strings. For example, the find() method in Python can be used to search for a substring within a larger string, and the index() method can be used to find the index of a substring within a string. Conditional statements. In some cases, you may be able to use conditional statements (such as “if...” and “...else”) to check for patterns within a string or other data structure. For example, you might use an if statement to check if a string starts with a certain letter or if it contains a certain sequence of characters. Loop constructs such as for and while loops can be used to iterate over the elements of a string or other data structure, and to perform operations based on the values of those elements. Custom functions. You can also define custom functions to perform pattern matching in your code. These functions can use any of the techniques described above, or other approaches, to search for and identify patterns within data. Regex pattern matches Regular expression (regex) pattern matching is a technique for identifying and extracting patterns in strings. A regular expression is a sequence of characters that defines a search pattern and can be used to match, search, and manipulate strings. To use a regex pattern to match against a string, you can use a regex library or built-in function in your programming language of choice. For example, in Python, you can use the re-module to work with regular expressions. There are many different regex patterns that you can use to match different kinds of patterns in strings. Some common regex patterns include: e \d: matches any digit (0-9) e \w: matches any word character (a-z, A- Z, 0-9, and _) e \s: matches any whitespace character (space, tab, newline, etc.) e 4: matches the start of a string e $: matches the end of a string e *: matches zero or more repetitions of the preceding character or group e +: matches one or more repetitions e ?: matches zero or one repetition

You might also like