Sns College of Technology Sns College of Technology Sns College of Technology Sns College of Technology
Sns College of Technology Sns College of Technology Sns College of Technology Sns College of Technology
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING (UG & PG) Third Year Computer Science and Engineering, 6th Semester Subject Code & Name : OPEN SOURCE SOFTWARE Prepared by: T.MYTHILI L/CSE, SATHYA SEELAN L/CSE UNIT I : INTRODUCTION 1. What is Open source software? Open Source Software is software for which the underlying programming code is available to the users so that they may read it, make changes to it, and build new versions of the software incorporating their changes. There are many types of Open Source Software, mainly differing in the licensing term under which (altered) copies of the source code may (or must be) redistributed. 2. What is the Need of Open Source Systems? No initial cost No licensing issues Openness and Transparency Speed of Access Freedom of movement Portable Reliable Stable Security
3. What are the four important factors that led to the development of open source software? The following are the four important factors that lead to the development of Open Source Software: 1. To diminish the high monopoly value of the Proprietary Software 2. To avoid discrimination among persons like developers of the product and users of the product 3. To enable the user finding and fixing the bugs themselves 4. To allow customers to have control over the products they use and to redistribute the same with or without modifications. SNSCT Department of Computer Science & Engineering (UG&PG) Page 1
5. Mention some Applications of Open Source Systems? Finance Educational Data Storage and Management Games Media Networking and Internet Graphics
6. Give some characteristics of Linux? Some Characteristics of Linux is a Unix-like computer operating system one of the most prominent examples of free software and open source development: typically all underlying source code can be freely modified, used, and redistributed by anyone The name "Linux" comes from the Linux kernel, started in 1991 by Linus Torvalds Predominantly known for its use in servers supported by corporations such as Dell, Hewlett-Packard, IBM, Novell, Oracle Corporation, Red Hat, and Sun Microsystems used as an operating system for a wide variety of computer hardware, including desktop computers, supercomputers, video game systems, such as the PlayStation 2 and PlayStation 3, several arcade games, and embedded devices such as mobile phones, routers, wristwatches, and stage lighting systems
Page 2
9. List the disadvantages of Linux 10. What are the types of system? Operating system is a generic term which in fact describes several families of systems Single task system: Only one program may be run at a time, and therefore only one person may work on a machine at one time. However, the process may make use of the whole of the resources and power of the machine Multi task system: Several Processes can be executed in parallel. Operating time is cut up into small intervals and each process is executed during these short periods. Learning Lack of equivalent programs More technical ability needed Not all hardware compatible
Page 3
12. Define Kernel mode and user mode The kernel is a privileged mode, in which no restriction is imposed on the kernel of the system. The kernel may use all the instructions of the processor, manipulate the whole of the memory, and talk directly to the peripheral controllers. The user mode is the normal execution mode for a process. In this mode, the process has no privilege. 13. Define Process and differentiate process and program A process can be considered to be a program being run. A program is not a process of itself; it is a passive entity while the process is a active entity with a program counter specifying the next instruction to be carries out, as well as the total associated resource. 14. What are the Process states? During the course of execution, processes change state. The state of a process is defined by its current activity. The different possible states of a process are the following In execution: the process is being executed by the processor, Ready: the process could be executed, but another process is currently being executed Suspended: the process is waiting for a resource Stopped: the process has been suspended by the external process Zombie: the process has finished its execution but it is still referenced in the system
Page 4
Creatio
Stopped
Terminatio n
Zombi e
End of Input/output
Suspended
Input/output
16. What are the attributes of the process? During execution, a process is characterized by several attributes maintained by the system: Its state Its identification The values of the registers, including the program counter The user identity whose name the process is executing The information used by the kernel to establish the schedule of the processes Information concerning the address space of the process Information concerning the inputs/outputs carried out by the process Compatibility information summarizing the resources used by the process
17. What are the types of Process Iedntifiers Identification of the real user Identification of the effective user Page 5
20. What are the different scheduling policies in Linux The Linux scheduler has three different scheduling policies: one for normal Processes, and two for real time processes SCHED_FIFO, for a unalterable real time process. SCHED_RR, for an alterable real time process, SCHED_OTHER, for a classical process. 21. Define Personality In order to allow programs coming from other operating system to be run in Linux, Linux supports the idea of personalities. Each process is assigned to an execution domain. This domain specifies the way in which system calls are carried out, and the way in which messages are processed. 22. What a personality defines? System calls: Linux uses software interrupts to change into kernel mode, whilst other Unix system use an inter- segment jump. Message number specified by processes: When a process specifies a message number, for example in calling the primitive sigaction or kill, the message number is converted by means of look-up-table Number of messages sent to processes: when a message is to be sent to a process, the message number is converted by means of look-up-table
23. What is the system call available to change the personality? The system call personality allows a process to modify its execution domain in order that Linux can emulate the behavior of another operating system. int personality(int pers); SNSCT Department of Computer Science & Engineering (UG&PG) Page 6
30. What is the system call available to send a signal? The system call Kill is used to send a signal to a process or a group of processes. int kill( pid_t pid, int sig); This returns 0 on no error and -1 on error Sig- signal t be sent Pid - identity of the receiving entity If pid=positive, the signal sig is sent to the process identified by pid If pid=NULL, the signal sig is sent to the sender group of the sender If pid=-1 the signal sig is sent to all process except the first If pid<-1 the signal sig is sent to a group of process identified by pid To sent a signal to group of processes, there is also the call killpg int killpg(int pgrp, int sig) This returns null if it is sent to the group Pgrp- represents the group the signal is sent to. To sent signal to itself int raise(int sig);- in the event of error it sends a non zero value
31. List some of the GNU tools gcc ,Debugger,Strace and Make
32. What are the formats supported in Linux for executable programs Linux supports two formats for executable programs a.out-binary format ELF dynamic libraries 33. Define Library and its types Libraries constitute a simple meaning of gathering several object files together Static : during link editing, the library code is integrated with the executable code Dynamic: the library code is loaded when program is executed`
Page 8
BIG QUESTIONS: 1. Need of open source. 2. Advantages of open source. 3. Applications of open source. 4. Describe the general operating systems structure. 5. Explain about process. 6. Explain scheduling. 7. Explain Personalities. 8. Explain Cloning. 9. Explain about Signals. 10.Describe the development with Linux.
Page 9
Highly efficient Open source Highly secured since All password traffic is encrypted connecting to a server. Offers a high scalability in terms of size and connectivity.
3. What is "mysqld"? mysqld is a daemon server program typically used to start and stop mysql server. It runs in the background 4. How can you connect to the MySQL Server? In order to connect to the MySQL server, it is required to give the username and password. So this can be done with the following % mysql h localhost p u root -h localhost to connect to the MySQL server running on the local host -p to tell mysql to prompt for a password -u root to connect as the MySQL root user
5. How can you Start MySQL Server? To start the mysql program type its name in the command- line prompt. After starting the mysql program just display a welcome message using the following Syntax: % mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 18427 to server version: 3.23.51-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>
7. Explain the tools that are available for managing MySQL Server. Following are the tools to manage MySQL server: mysqld - MySQL server daemon. It is used to start the mysql server. mysqladmin Used to perform administrative tasks. mysql - A command-line interface for end users to manage user data objects. mysqlcheck - A command-line interface for administrators to check and repair tables. mysqlshow - A command-line interface for end users to see information on tables and columns. mysqldump - A command-line interface for administrators or end users to export data from the server to files. mysqlimport - A command-line interface for administrators or end users to load data files into tables program tool to load data into tables.
8. What are the capabilities provided by MySQL client APIs? Connecting to the MySQL server; selecting a database; disconnecting from the server. Checking for errors. Issuing queries and retrieving results. Using prepared statements and placeholders in queries. Including special characters and NULL values in queries. Handling NULL values in result sets.
9. What are the three fundamental operations that are common to MySQL Programs? Establishing a connection to the MySQL server. Selecting a database. Disconnecting from the server
12. What are the categories of SQL Statements? Statements that do not return a result set. This statement category includes INSERT, DELETE, and UPDATE. Statements that return a result set, such as SELECT, SHOW, EXPLAIN, and DESCRIBE. MySQL_fetch_array(),
Mysql_fetch_object returns the result from the database as objects while mysql_fetch_array returns result as an array. This will allow access to the data by the field names. E.g. using mysql_fetch_object field can be accessed as $result->name and using mysql_fetch_array field can be accessed as $result->[name]. mysql_fetch_row($result):- where $result is the result resource returned from a successful query executed using the mysql_query() function. Example: $result while($row { } = mysql_query(SELECT = Some * from students); mysql_fetch_row($result)) statement;
14. What are the two types of methods for retrieving rows in Python? Fetchone()- Returns the next row as a sequence Fetchall()- Returns the entire result set as a sequence of sequences
17. What are the various ways in which SELECT statement can be used for record selection Technology? SELECT gives you control over several aspects of record retrieval: Which table to use Which columns to display from the table What names to give the columns Which rows to retrieve from the table How to sort the rows 18. What is the keyword which can be used to combine column values? Give Eg. Column values may be combined to produce composite output values using the CONCAT() Keyword. Example:
When the original table is large then it takes large time to work with so it is better to work with the which takes less time The data-loading operations that may be malformed when used with original table can go with the copy to ensure safety The summary operations when repeatedly done over the original table are expensive so copy can be used to print the summary which is not expensive as original table 22. What is the use of creating such tables? How can you create temporary tables? When you need a table only for a short time, then you want it to disappear automatically you can go to create a temporary table. This is extremely useful behavior because you need not remember to remove the table The Temporary tables can be created using the keyword CREATE TEMPORARY TABLE 23. What are the disadvantages of creating a temporary table? If you've already created a temporary table with a given name, attempting to create a second one with that name results in an error. persistent connections may tend not to drop the temporary table because the connection is let open for the use of next script If a client program automatically reconnects after a dropped connection, you'll be modifying the original table after the reconnect
25. What are the types of Strings? A binary string in MySQL is one that MySQL treats as case sensitive in comparisons. A non binary string in MySQL is one that MySQL does not treats as case sensitive in comparisons. For binary strings, the characters A and a are considered different. For non-binary strings, they're considered the same.
26. Does the MID() acts the same way as SUBSTRING() ? Justify MID() acts the same way as the SUBSTRING() if the third argument of the MID() is omitted. 27. What are the ways provided by MySQL for Pattern Matching? MySQL provides two kinds of pattern matching. 1) One is based on SQL patterns 2) regular expressions. 28. What are the data types supported by MySQL for Date and Time formats? MySQL supports a number of date and time column formats: Some of them are DATE DATETIME TIMESTAMP 29. Give Examples of various type of Date and Time formats. It is most common to store dates using a dash (-) as the delimiter and a colon (:) as the time delimiter. The Following formats can also be used. 2008-10-23 10:37:22 20081023103722 2008/10/23 10.37.22 2008*10*23*10*37*22
BIG QUESTIONS
1. Explain Setting up account in MYSQL. 2. Explain Starting, terminating MySQL. 3. Explain SQL programs with suitable examples. 4. Explain Record selection Technology 5. Explain Date and Time in MYSQL. 6. Explain Sorting Query Results in MYSQL. 7. Explain about Generating Summary. 8. Define Metadata and explain it with example. 9. Define sequences and explain with examples. 10. Explain about the MySQL and Web.
12. What are the flow control statements available in PHP and give the syntax of each statement? if if (expression)
statement if else if (expression) statement
switch switch($name) { case 'ktatroe': // do something break; case 'rasmus': // do something break;} while while (expression)
statement
do/while do
statement while (expression)
13. Define Function A function is a named block of code that performs a specific task, possibly acting upon a set of values given to it, or parameters, and possibly returning a single value. 14. Give the syntax to call a function $some_value = function_name( [ parameter, ... ] );
15. Give the syntax to define a function To define a function, use the following syntax: function [&] function_name ( [ parameter [, ... ] ] ) { statement list }
28. What are the functions available to search a string? strpos() - The way strpos works is it takes some string you want to search in as its first argument and another string, which is what you are actually searching for, as the second argument. $pos = strpos($mystring, $findme); str_replace() - The str_replace function is similar to a word processor's "Replace All" command str_replace(search, replace, originalString). substr_replace() - The function substr_replace introduces some additional functionality to compliment str_replace. substr_replace is a more mathematically based replace function, which relies on starting points and lengths to replace parts of strings, as opposed to searching and replacing. substr_replace(original string, replacement string, starting point) 29. What are the capitalization functions available in PHP? PHP has three primary capitalization related functions: strtoupper strtolower and ucwords.
The function names are pretty self-explanatory 30. Define Regular Expression and what are the regular expressions supported by PHP A regular expression is a string that represents a pattern. The regular expression functions compare that pattern to another string and see if any of the string matches the pattern. PHP provides support for two different types of regular expressions: POSIX Perl compatible.
31. What are the three uses of regular expressions matching, which can also be used to extract information from a string; substituting new text for matching text; splitting a string into an array of smaller chunks.
36. Mention the advantages of simple text file system 1) Minimization of cost. Cost of maintaining databases like Oracle are huge, thus files are low cost answer to these databases. 2) Taking back Up of your database is very easy. All you have to do is to copy the file. 3) It much easier to transfer a text file from one OS to another.
42. What are the functions available to display a file? int fpassthru(int fp) int readfile(string filename)
43. What are the functions available to navigate within a file? int rewind(int fp) int fseek(int fp, int offset [, int whence]) int ftell(int fp) int feof(int fp) 44. What are the functions available to copy , rename and delete a file? int copy(string source, string destination) int rename(string oldname, string newname) int unlink(string filename) 45. What are the functions available to determine the attributes of a file? int file_exists(string filename) int fileatime(string filename) int filectime(string filename) int filemtime(string filename) int filesize(string filename) string filetype(string filename) 46. What are the three places where the data can be stored in PHP? flat file session variables cookies. 47. Define flat files and mention its advantages over databases Flat files are text files stored in the computer file system. Humans can read flat files by using the operating system commands that display files, such as cat in Linux and Unix. Flat files have some advantages over databases: Available and versatile: You can create and save data in any operating system's file system. You don't need to install any extra software. Additionally, text data stored in flat files can be read by a variety of software programs, such as word processors or spreadsheets.
Simple "die()" statements Custom errors and error triggers, Error reporting
Give the Importance of PHP Seurity PHP is widely used language for web applications PHP is making headway into enterprise as well as corporate markets Most effective and often overlooked measure to prevent malicious users PHP applications often end up working with sensitive data 52. What are the concerns of PHP security? Register Globals SQL Injection Cross Site Scripting User login systems
53. Define Template A template is an HTML-like document that defines the presentation of a web page, while a PHP script supplies the content. The separation of content and presentation is at the heart of any GUI paradigm.
BIG QUESTIONS 1. Explain PHP Programming using some examples. 2. Explain Variables, Constants, Data types in PHP with example. 3. Explain Operators , Statements, Functions and Array in PHP 4. Explain String Manipulation and expression in PHP. 5. Explain File handling and Data storage. 6. Explain PHP and SQL database 7. Explain PHP and LDAP 8. Describe PHP Connectivity in detail. 9. How Sending and receiving E-mails can de achieved. 10. Explain in detail Debugging and error handling 11. How Security and Templates can be implemented using PHP.
12. H o w can you access elements using slice operator? The syntax for accessing an individual element is: sequence[index] The syntax for accessing a group of elements is: sequence [ [starting_index]: [ending_index]] 13. How to Create and Assign Strings Creating strings is as simple as assigning a value to a variable: >>> aString = 'Hello World!' >>> print aString Hello World! >>> aBlankString = '' >>> print aBlankString '' 14. How to Access Values(Characters and Substrings) in Strings Python does not support a character type; these are treated as strings of length one, thus also considered a substring. To access substrings, use the square brackets for slicing along with the index or indices to obtain your substring: >>> aString = 'Hello World!' >>> aString[0] 'H' >>> aString[1:5] 'ello' >>> aString[6:] 'World!' 15. How to Update Strings You can "update" an existing string by (re)assigning a variable to another string. The new Value can be related to its previous value or to a completely different string altogether. >>> aString = aString[:6] + 'Python!' >>> aString SNSCT Department of Computer Science & Engineering (UG&PG) Page 33
31. Define pass statement One Python statement not found in C is the pass statement. Because Python does not use curly braces to delimit blocks of code, there are places where code is syntactically required. We do not have the equivalent empty braces or single semicolon the way C has to indicate "do nothing." If you use a Python statement that expects a sub-block of code or suite, and one is not present, you will get a syntax error condition. For this reason, we have pass, a statement that does absolutely nothingit is a true NOP, to steal the "No OPeration" assembly code jargon 32. List the file built in methods File methods come in four different categories: input output movement within a file("intra-file motion") and miscellaneous 33. DefineCommand line arguments Command-line arguments are those arguments given to the program in addition to the script name on invocation. Historically, of course, these arguments are so named because they are given on the command-line along with the program name in a textbased environment like a Unix- or DOS-shell. 34. Define Pickling or flattening or serializing or marshelling Pickling is the process whereby objects more complex than primitive types can be converted to a binary set of bytes that can be stored or transmitted across the network, then be converted back to their original object forms. Pickling is also known as flattening, serializing, or marshalling. 35. What is the function of DBM- Style module and shelve module The *db* series of modules writes data in the traditional DBM format The shelve module uses the anydbm module to find a suitable DBM module, then uses cPickle to perform the pickling process. The shelve module permits concurrent read access to the database file, but not shared read/write access. SNSCT Department of Computer Science & Engineering (UG&PG) Page 37
53. Define callable object Any object that can be invoked with the function () operator. The function operator is placed immediately following the name of the callable to invoke it 54. Define code object There are other executable objects in python that do not have the ability to be invoked like callable. These objects are the smaller pieces of the puzzles that make up executable blocks of code called code object. 55. Define restricted execution and terminating execution Restricted execution can be facilitated by rexec which can modify the objects and bastion module which acts as a attribute filter. A clean execution occurs only when a program runs to completion. The execution is terminated either by exception handling or cleaner.
BIG QUESTIONS
1.Explain about Syntax and Style in python 2. Explain Python Objects 3. Explain Numbers, Sequences and Strings 4. Explain Lists , Tuples and Dictionaries 5.Explain Conditionals and Loops 6.Exaplin Files Input/output in python 7.Explain types Errors and Exceptions in python 8.Explain Functions and Modules 9. Explain Classes and OOP. 10. Explain Execution Environment.