Search This Blog

Showing posts with label Frequently Asked Questions. Show all posts
Showing posts with label Frequently Asked Questions. Show all posts
Monday, 6 May 2013

Previous Year Question Paper on Open Source Software

0 comments

B.E. / B.Tech. DEGREE EXAMINATION, MAY/JUNE 2012
Sixth Semester
080230027 – OPEN SOURCE SOFTWARE
(Regulation 2008)

Answer ALL Questions

PART A (10 X 2 = 20 marks)

  1. List the advantages of open source software. 
    Key Advantages of OSS are listed below: 
    • No cost or a lower cost for licensing "open source" solutions
    • Flexibility: A programmer can take a standard software package and modify it to better suit business needs. 
    • Continuing software enhancements available through the open source community 
    • Reliability and Quality: Mature open source software is generally viewed to be of good quality and reliability.
    • Reduces “Vendor Lock-in”: If we are using proprietary software we may be restricted to using certain vendors. Switching vendors in this case usually involves significant costs. 
    • Availability of External Support: We can usually hire a programmer to add a particular function to open source software. Some vendors offer support contracts and there are service providers that install, configure and maintain an OSS system. Many open source products also have active online community support that may be able to answer your questions through online blogs.
  2. What is the differentce between kernel mode and user mode? 
            In Kernel mode, the executing code has complete and unrestricted access to the underlying hardware. It can execute any CPU instruction and reference any memory address. Kernel mode is generally reserved for the lowest-level, most trusted functions of the operating system. Crashes in kernel mode are catastrophic; they will halt the entire PC.
            In User mode, the executing code has no ability to directly access hardware or reference memory. Code running in user mode must delegate to system APIs to access hardware or memory. Due to the protection afforded by this sort of isolation, crashes in user mode are always recoverable. Most of the code running on your computer will execute in user mode.
  3. How to create a table in MySQL when it does not exist?
            This is the sql syntax for create table. Utilise the IF NOT EXISTS clause to create a table when it does not exist:

            CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)] 
  4. How to create a new user in MySQL database server?  
           The user creation process continues with inserting the new user's values such as host, username and password into the user table in the MySQL database, containing the log-in details of everyone who has any level of access to the database. 
           This is done with the help of CREATE USER command, which is available only in MySQL 5 (5.0.2) and newer releases, and it follows this syntax:
                CREATE USER user [IDENTIFIED BY [PASSWORD] 'password']
           For instance, creating a user 'michael' with a password 'mypassword123' is done by establishing a connection to the MySQL server as root and executing the following query:
              CREATE USER michael IDENTIFIED BY PASSWORD 'mypassword123';
  5. List the different data types supported in PHP.
  6. Using while loop write a php code to display 1 to 5.
  7. List the dictionaries operations in Python.
  8. What is the difference between tuple and list in Python?
  9. Highlight the features of Perl.
  10. What is the use of ARGV in Perl?

PART B (5 X 16 = 80 marks)

11. (a) (i) List any eight file related commands in Linux and explain their features. (8)
          (ii) Discuss the different types of file systems in Linux. (8)
Or
(b) (i) List any eight Linux signals and highlight their features. (8)
    (ii) Explain the scheduling mechanisms in Linux. (8)


12. (a) (i) List any four string related functions in MySQL and explain its syntax. (8)
          (ii) How to use MySQL Left join to select data from multiple tables? Explain. (8)
Or
(b) (i) What is metadata in MySQL? How to obtain it and use it? Explain. (8)
     (ii) Explain the process of sorting the Query results in MySQL. (8)


13. (a) (i) Explain the process of uploading files to the server in PHP. (8)
          (ii) How will you use PHP to access data from MySQL? (8)
Or
(b) (i) Explain the process of sending an e-mail with PHP. (8)
    (ii) Explain debugging and error handling process in PHP. (8)


14. (a) (i) Write a Python program to print Fibonacci series. (8)
          (ii) How to use Python as a Calculator? Explain with any to examples. (8)
Or
(b) (i) Explain the error and exception handling mechanisms in Python. (8)
     (ii) Write Python code to create an account object with two functions. (8)


15. (a) (i) List and explain the control structures in Perl. (8)
          (ii) List and explain the various file operations in Perl. (8)
Or
(b) Explain the data manipulation functionalities provided by Perl. (16)
Continue reading →
Monday, 19 December 2011

Frequently Asked Questions on C Programming

0 comments

FREQUENTLY ASKED QUESTIONS IN C! 

  1. Why do we call C a middle-level language?
The C programming language is considered by some to be a “middle-level” language because it provides low-level capability at the expense of some user-friendliness.
Initially, some cynics remarked sarcastically, “C combines the flexibility and power of high-level language with the user-friendliness of assembly language.” However, they were wrong, as C soon became the “lingua franca” of the computer professionals.
  1. Why do we write “# include <stdio.h>” at the top of a C source file?
It lets the compiler know some important information about some of the library functions, e.g., printf() and scanf(). The prototypes for the standard I/O (input and output) functions are stored in this file. This information is useful for the error checking by the compiler.
  1. Why should we use comments in a C program?
Comments are non executable statements that are explicitly added in a program to make it easier for a human reader to understand the code better. The compiler simply ignores them and so they do not contribute anything to the C program as far as the compiler is concerned.
We can use a comment for describing what a particular variable is for, describing what a function is for and how it works, documenting the name, version number, purpose, and programmer of an entire program, explaining any tricky or hard-to-understand part about a program etc.
  1. What are the largest and smallest values that can be reliably stored in a variable of type int?
32,767 and -32,768
  1. What is the difference between the constants 7, ‘7’, and “7”?
The constant 7 is the integer 7. The constant ‘7’ is a character constant consisting of the character ‘7’. The constant “7” is a string constant consisting of one character, the character ‘7’.
  1. What is the difference between the constants 123 and “123”?
The constant 123 is the integer 123. The constant “123” is a string constant containing the characters ‘1’ ‘2’ and ‘3’.
  1. What is the function of the semicolon in a C statement?
It is the statement terminator.
  1. Name three uses of the semicolon in C.
Terminating declarations, terminating statements, and separating the three control expressions in a for loop.
  1. What is the numeric value of the expression 3<4?
1 (or “true”), because three is in fact less than 4.
  1. What is wrong with the #define N 10; ?
The semicolon at the end of the line will become part of N’s definition, which is hardly ever what you want.
  1. What are the two different kinds of division that the / operator can do? Under what circumstances does it perform each?
The two kinds of division are integer division, which discards any remainder, and floating-point division, which yields a floating-point result (with a fractional part, if necessary).
Floating-point division is performed if either operand (or both) is floating-point (that is, if either number being operated is floating-point); integer division is performed if both operands are integers.
  1. What are the definitions of the “Boolean” values – true and false in C?
False is always represented by a zero value. Any non zero value is considered to be true. The built-in operators <, <=, >, >=, ==, !=, &&, ||, and ! always generate 0 for false and 1 for true.
  1. What would the expression i = i++ do?
Since it tries to modify i twice, it is undefined. If we just wanted to increment i once, we should have written just i++ or written i = i + 1 (but not both).
  1. What does printf(“%-10d”, n) print if n is an integer?
Normally, an integer is printed right justified. %-10d causes the text to be left-justified and printed in 10 spaces irrespective of its value.
  1. Where are header (“#include”) files searched for?
The exact behavior is implementation defined. Typically, headers named with <> syntax area searched for in one or more standard places. Header files named with “” syntax are first searched for in the current directory, then (if not found) in the same standard places.
  1. How can a ‘%’ character be printed in a printf format string? (\% doesn’t work)
Double the percent sign: %%. \% can’t work, because the backslash \ is the compiler’s escape character, while here our problem is that the % is printf’s escape character.
  1. When a number is read with scanf %d and then a string is read with gets(), the compiler seems to skip the call to gets()! Why?
Scanf %d would not consume a trailing newline. If the output number is immediately followed by a newline, that newline will immediately satisfy the gets().
As a general rule, we shouldn’t try to interlace calls to scanf with calls to gets() (or any other input routines); scanf’s peculiar treatment of newlines almost always leads to trouble. Either use scanf to read everything or nothing.
  1. What are the important syntactic characteristics of a C Program?
The important characteristics of a C program are:
  • Comments are enclosed by “/*” and “*/”. Comments can go almost anywhere, since the compiler ignores them.
  • Most lines of statements in the program end with a “;” but some do not. Either forgetting a “;” or adding one where it isn’t needed is a common source of C programming buts. Lines of codes are grouped by using curly braces (“{“ and “}”).
  • C is case-sensitive. All C keywords are in lower-case. We can declare program variables and function names in whatever case we want, but by convention they should be in lower case. Constants are upper case by convention.
  1. How many elements does the array int a[5] contain? Which is the first element? The last?
The array has 5 elements. The first is a[0]; the last is a[4].
  1. What would the expression c = getchar() != EOF do?
It would read one character and compare it to the constant EOF. If the character read was equal to EOF, it would set c to 1, otherwise (i.e., for any other character) it would set c to 0.
What it would not do is read a character, assign it to c, and then test it against EOF, which is what we usually want to do, and which we need to write
(c = getchar()) != EOF
  1. Define string in C.
An array of characters, terminated with the null character ‘\0’.
  1. What is the difference between these initializations?
char a[] = “string literal”;
char *p = “string literal”;
A string literal can be used in two slightly different ways. As an array initializer (as in the declaration of char a[]), it specifies the initial value of the characters in that array. Anywhere else, it turns into an unnamed, static array of characters, which may be stored in read-only memory, which is why we can’t safely modify it.
In an expression context, the array is converted at once to a pointer, as usual, so the second declaration initializes p to point to the unnamed array’s first element. Our program may crash if we try to assign a new value to p[i].
  1. What happens if we overrun the elements of an array and crossover the end?
In such a case, we have the danger of over-writing any variables that we may have stored beyond the end of the array. The C compiler will simply generate code to access as many elements as we specify- it is not concerned with whether we reach the end of the array or not.
  1. What are console I/O functions? What is special about the console I/O functions?
DOS-based compilers also have an alternative library of console I/O functions. These functions require the declaration:
#include<conio.h>
The three most useful PC console I/O functions are:
getch(): To get a character from the keyboard (no need to press Enter).
getche(): Gets a character from the keyboard and echo it.
kbhit(): Checks to see if a key has been pressed.
These are DOS-only commands, though some compilers on other platforms may have similar functions.
  1. What is the utility of the kbhit() function?
The kbhit() function only tells use if a key has been pressed or not. It returns a nonzero value if a key has been pressed, and zero if it hasn’t. This allows the program to poll the keyboard for input rather than hanging and waiting for something to happen.
  1. If we say int i=5; int *ip = &I; then what is ip? What is its value?
ip is a variable which can point to an int (that is, its value will be a pointer to an int; or informally, we say that ip is a pointer to an int). Its value is a pointer that points to the variable i. If we wanted ip itself to store that address of or point to i we should have written ip = &i;
  1. If ip is a pointer to an int, what does ip++ mean? What does *ip++ = 0 do?
ip++ means about the same as it does for any other variable: increment it by 1, that is, as if we had written ip = ip + 1. In the case of pointer, this means to make it point to the object (the int) one past the one it used to. *ip++ = 0 sets the int variable pointed to by ip to 0, and then increments ip to point to the next int.


  1. If p is a pointer, what does p[i] mean?
It means the same as *(p+i), or, in other words, the contents of the object i locations past the one pointed to by p.
  1. Since array references decay into pointers, if arr is an array, what’s the difference between arr and &arr?
The type. In standard C, &arr is a pointer, to the entire array. Under all C compilers, a simple reference (without an explicit &) to an array yields a pointer, of type pointer-to-T, to the array’s first element.
  1. What are the four important parts of a function? Which three do we need to know to call a function?
The name of the function, the number and type of arguments to be passed, the return type, and the body are the four important parts of a function. The caller needs to know the first three.
  1. What is the difference between a parameter and an argument?
We must note that the word “parameter” is sometimes used in place of “argument”. There is actually a fine distinction between these terms: the calling routine specifies “arguments” to the called function, while the called function receives the “parameters” from the calling routine.
  1. How is a parameter handled in a C function?
When we list a parameter in the function header, it becomes a local variable to the function. It is initialized to the value provided to it as an argument by the calling routine. Parameters are matched with arguments in the order in which they are sent.
  1. Is it necessary that every function should have at least one return statement that returns a particular value?
A function does not necessarily have to return a value. Without a value, “return” simply causes the function to return control to the calling routine. This of course implies that the data type of the function be declared as “void”.
  1. Is it possible to define a function that accepts a variable number of parameters?
Yes, it is possible to define functions with a variable number of parameters. In fact, printf() is such a function that we are familiar with.
  1. What are the four parts of a structure definition?
The keyword struct, the structure tag (optional), the brace-enclosed list of member declarations (optional), and a list of variables of this structure type to be declared (optional) are the four parts of a structure definition.
  1. Why doesn’t the following structure declaration work?
struct x{... … …};
x thestruct;
Typedef names are not automatically generated for structure tags. We have to generate them explicitly.
  1. How are structure passing and returning implemented?
When structures are passed as arguments to functions, the entire structure is typically pushed on the stack, using as many words as are required. Programmers often choose to use pointers to structures instead, precisely to avoid this overhead. Some compilers merely pass a pointer to the structure, though they may have to make a local copy to preserve pass-by-value semantics.
Structures are often returned from functions in a location pointed to by an extra, compiler-supplied “hidden” argument to the function.


Continue reading →