Friday, 9 June 2017

C Language NIELIT Exam Paper Solution

NIELIT O Level
C Language  Paper Answer 
January - 2015

1: Objective 


1.1 B
1.2 : C
1.3 : D
Explanation :  Because pointer is not being part of any equation so option a and d is equal.
1.4 : D

Explanation : P is a pointer which return integer pointer and takes argument as integer pointer.
1.6 : C
Explanation : Tree stores data in hierarchical manner.




1.7 : C
Explanation Loop

1.8 :  B
1.9 : C
1.10 : B
Explanation : 
A full binary tree (sometimes proper binary tree or 2-tree) is a tree in which every node other than the leaves has two children.

2 : True-False

2.1 : T

Explanation :  Modify is a command which let you modify to more than one records.

2.2 : F

Explanation :  In relational schema each tuple is divided into fields called Domain.

2.3 : F
Explanation : Quick Sort

2.4 : F
Explanation   : Stack is used to convert infix to prefix

2.5 : T

Explanation   
In the best case analysis, we calculate lower bound on running time of an algorithm. We must know the case that causes minimum number of operations to be executed. In the linear search problem, the best case occurs when x is present at the first location. The number of operations in the best case is constant (not dependent on n). So time complexity in the best case would be Θ(1)

Most of the times, we do worst case analysis to analyze algorithms. In the worst analysis, we guarantee an upper bound on the running time of an algorithm which is good information.

The average case analysis is not easy to do in most of the practical cases and it is rarely done. In the average case analysis, we must know (or predict) the mathematical distribution of all possible inputs.
The Best Case analysis is bogus. Guaranteeing a lower bound on an algorithm doesn’t provide any information as in the worst case, an algorithm may take years to run.

2.6 : T

Explanation   :

forest tree definition






2.7 : T
2.8 : T
Explanation   : 

Think of a priority queue as a kind of bag that holds priorities. You can put one in, and you can take out the current highest priority. (Priorities can be any Comparable values; in our examples, we'll just use numbers.)

priority queue


A priority queue is different from a "normal" queue, because instead of being a "first-in-first-out" data structure, values come out in order by priority. A priority queue might be used, for example, to handle the jobs sent to the Computer Science Department's printer: Jobs sent by the department chair should be printed first, then jobs sent by professors, then those sent by graduate students, and finally those sent by undergraduates. The values put into the priority queue would be the priority of the sender (e.g., using 4 for the chair, 3 for professors, 2 for grad students, and 1 for undergrads), and the associated information would be the document to print. Each time the printer is free, the job with the highest priority would be removed from the print queue, and printed. (Note that it is OK to have multiple jobs with the same priority; if there is more than one job with the same highest priority when the printer is free, then any one of them can be selected.)

The operations that need to be provided for a priority queue are shown in the following table, assuming that just priorities (no associated information) are to be stored in a priority queue.

Source Form :http://pages.cs.wisc.edu/~vernon/cs367/notes/11.PRIORITY-Q.html

2.9 : T
Explanation : In symmetric directed graph edge reversing produce same graph.

symmetric directed graph

2.10 : T

Explanation : In graph theory, the degree (or valency) of a vertex of a graph is the number of edges incident to the vertex, with loops counted twice. The degree of a vertex  v is denoted  or  v. The maximum degree of a graph G, denoted by Δ(G), and the minimum degree of a graph, denoted by δ(G), are the maximum and minimum degree of its vertices. In the graph on the right, the maximum degree is 5 and the minimum degree is 0. In a regular graph, all degrees are the same, and so we can speak of the degree of the graph.

Example : Get  Maximum degree in any vector in a graph

 Let G be a simple graph with P-vertices. Consider any vertex v of G. Since the graph is simple (i.e., without self loops and parallel edges), the vertex v can be adjacent to almost remaining (P – 1)
vertices.

Hence the maximum degree of any vertex in a simple graph with P vertices is (P – 1).

Maximum degree in any vector in a graph

Math The Column


3.1 : F
Explanation :  When referring to computer memory, a null pointer is a command used to direct a software program or operating system to an empty location in the computer memory. Commonly, the null pointer is used to denote the end of a memory search or processing event. In computer programming, a null pointer is a pointer that does not point to any object or function.

3.2 : G

 ?As the name states, Ternary means composed of three parts.

Ternary operator needs exactly 3 operands to compute the result. In C, If statement can be written as ternary operator (?:).

if(a<b){
c=5;
}
else{
c=10;
}
The above if block can be re-written using ternary operator like this (below).

c=(a<b)?5:10;


3.3 :  J
Explanation : 

#define NULL 0

3.4  : I

3.5 :  L
 Explanation : In operating systems, seek time is very important. Since all device requests are linked in queues, the seek time is increased causing the system to slow down. Disk Scheduling Algorithms are used to reduce the total seek time of any request.

3.6 : C
3.7 : K
3.8 : E
3:9 : F
3.10 : M

 Explanation : In c language all pointer always takes 2 byte. Because a pointer always takes address of a memory location. So byte is sufficient to refer any location.

Fill in the Blank

4.1 : E
4.2 : F
4.3 :  D

 Explanation :  Open-source software (OSS) is computer software with its source code made available with a license in which the copyright holder provides the rights to study, change, and distribute the software to anyone and for any purpose. Open-source software may be developed in a collaborative public manner. According to scientists who studied it, open-source software is a prominent example of open collaboration.

4.4 :  not option is given (answer is double)

 Explanation :  double: It is used to store decimal numbers (numbers with floating point value) with double precision.

4.5 : G
4.6 : K
4.7 : B
4.8 : I

 Explanation : 


Insertion Sort



Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort. However, insertion sort provides several advantages:



  • Simple implementation: Jon Bentley shows a three-line C version, and a five-line optimized version
  • Efficient for (quite) small data sets, much like other quadratic sorting algorithms
  • More efficient in practice than most other simple quadratic (i.e., O(n2)) algorithms such as selection sort or bubble sort
  • Adaptive, i.e., efficient for data sets that are already substantially sorted: the time complexity is O(nk) when each element in the input is no more than k places away from its sorted position
  • Stable; i.e., does not change the relative order of elements with equal keys
  • In-place; i.e., only requires a constant amount O(1) of additional memory space
  • Online; i.e., can sort a list as it receives it

When people manually sort cards in a bridge hand, most use a method that is similar to insertion sort

4.9 : L

 Explanation : The Dijkstra's algorithm basically finds the shortest path in a graph,hence used in many fields including computer networking(Routing systems).It also has application in Google maps to find the shortest possible path from one location to other....In Biology it is used to find the network model in spreading of a infectious disease.

4.10 : M
 Explanation : It is always recommended not to use goto statement as this reduces the readability of the program. It becomes difficult to trace the control flow of a program, making the program logic complex to understand .Using goto statement is considered as poor programming practice. Any program written in C language can be written without the use of goto statement. So try to avoid goto statement as possible as you can.

There are two types of jump in goto statement:
      1. Forward jump
      2. Backward jump

No comments:

Post a Comment