C-Programming and Data Structure - B.Sc. IT first (1) year 2018 Solved Paper

Hello friends, all of you will be very happy to know that in this article you will get the solved paper of the “C-programming and Data Structure” ‘s all question.Now you don’t have to roam around in books to find the answers.

C-Programming and D S – B.Sc. IT first (1) year 2018 Solved Paper

1. What is typedef ?

Answer :-

typedef is a keyword in C Programming. The typedef keyword is used to write a structure or union in short. We can say that we can give a nickname to the big structure and union name. With his help, we can use it in our program.

2. Define dynamic memory allocation.

Answer :-

Like an array is a collection of a prefix collection of values. Once the size of an array is declared, you cannot change it after.

Sometimes the size of the array you declared may be insufficient. To solve this problem, you can allocate memory manually during run-time. This is known as dynamic memory allocation in C programming.

3. What is use of \t in C programming ?

Answer :-

\t used for show tab space (” “) in our programis output generally in printf(” statements “);

Example :-

printf(“C\tProgrammng”); o/p C Programming

4. What do you mean by reference variable ?

 Answer :-

A reference variable is an alias, that is, another name(Different name) for an already existing var. Once a reference is declared with a variable, either the variable name or the reference name may be used to refer to the variable.

5. Define Register Variable.

Answer :-

Register Variable are stored in the CPU register. Its default value is a garbage Number. Scope of a register variable is local to the block in which it is defined. Lifetime is till control remains within the block in which the register variable is defined.

6. Define Kruskal’s algorithm.

Answer :-

It is an algorithm for finding the minimum cost spanning tree of the given graph. In kruskal’s algorithm, edges are added to the spanning tree in increasing order of cost. If the edge E forms a cycle in the spanning, it is discarded

7. What is ternary operator ?

Answer :-

Ternary operator is an alternative of “if – else” It is mostly use in single line codes.

Syntax :- <condition> ? value_if_true : value_if_false

Q-8. Differentiate prefix and postfix increment operator.

Answer :-

In the prefix operator (ex :- ++count), the value of count is incremented before, and the value of the expression is the new value of count. So basically it first increments then assigns a value to the expression of programe.

 In the postfix operator (exe: – count++), the value of count is incremented, after the expression solved. So is assign a value first and then incremented.

Q-9. How many bytes used by a double variable ?

Answer : – 8 bytes used by double Variable.

Q-10. Find out total number of elements for the following 4-D array : int a[4] [3][3][4];

Answer :- 144

C-Programming and D S – B.Sc. IT first (1) year 2018 Solved Paper

Q-11. Explain Nesting of Structure.

Answer :-

Nested structure in C is only structure inside structure. One structure can be proclaimed inside other structure as we pronounce structure individuals inside a structure.

We can use nested structure in two methods

(1) Using Simple Variable

(2) Using Pointer variable

Q-12. Write a program to call a function by reference. use this function to swap two values.

Answer :-

A simple program to swap two values by using their base address or pointer.

#include <stdio.h> void main(){   int num1, num2, *a, *b, temp;    printf("Enter the value of x and y\n");   scanf("%d%d", &num1, &num2);    printf("Before Swapping\nx = %d\ny = %d\n", num1, num2);    a = &num1;   b = &num2;    temp = *b;   *b = *a;   *a = temp;    printf("After Swapping\nx = %d\ny = %d\n", num1, num2);  } 

Q-13. Differentiate prefix, postfix and infix notations in brief.


Prifix,Postfix and Infix These are all different methods of calculation, through which we are able to explain our expression to the computer.


When an arithmetical expression is represented by putting operators before operand, such type of representation is called Prefix. This is also called as Polish Notation so don’t be confuse in exam.

Syntax :-


Example :-



The arithmetical expression where operator lies between two operands, such type of expression is called infix.

Syntax :-


Example :-

a + b


When operators are shifted after the operand, then such type of representation is called postfix. It is also called Reverse Polish Notation.

Syntax :-

<multi operand><operators>

Example :-


Q-14. Describe rules for create a valid identifier.

Answer :-

An Identifier is a unique name that used for a variable name,function name, data type name and lable Name.

Here are some meaningful rules of an identifier –

  1. An Identifier may only have alphabet or Numeric characters( Like – a-z, A-Z, 0-9) and we also use underscore. The first character of an identifier can only contain the alphabet or underscore.
  2. Identifiers are case sensitive in C Language. For example, c and C are two different identifiers in C Programming.
  3. Predefine Keywords are not allowed to be used as Identifiers.
  4. No special characters, such as semicolon, period, whitespaces, backslash, or comma are permitted to be used in or as Identifiers.

C-Programming and D S – B.Sc. IT first (1) year 2018 Solved Paper

Q-15. Explain explicit type conversion.

Answer :- We knows that when we do any operation on same data type values then the result is also output’s in same data type but in some condition we need differenty data type result (Ex – a/b=c,10/4=2.5) here “a” and “b” are integer data type values but the result “c” is a float value but by default 10/4=2 because of same data type.

So we need to change the data type of result when we use Explicit type conversion. By using this we can change the data type.

Syntax :-


Example :-


here in the example float changing the data type of 10 while calculation. when 10 is float data type then “4” automatically change in float. This process is called as Explicit Type Conversion.

Q-16. Differentiate quick sort and merge short in detail.

Answer :-

Merge sort and Quick sort both are sorting algorithms. Both are apply on array of values.

Quick sort

  1. In Quick sort, The Splitting of a list of elements is not necessary divided int o half.
  2. Worst-case Time complexity of Quick Sort is O(n2).
  3. Quick sort works well on smaller Array.
  4. Faster than other sorting algorithms for small Arrays(bubble sort, Selection sort, Insertion sort).
  5. Less additional storage space requirement.
  6. Quick Sort is not suitable for larger arrays.
  7. It is less efficient than Merge Sort.
  8. In Quick sort, the pivot element is used for the sorting.
  9. It is the internal sorting method because the data that has to be sorted is adjusted at a time in Main Memory.

Merge Sort

  1. In merge sort, Array or list is always divided into half (1/2) based on Divide and Conquer approach.
  2. Worst-case /time complesity of Merge sort is o(n log n).
  3. Merge sort operates fine in all types of Arrays.
  4. Consistent Speed in all types of Arrays.
  5. More additional Storage space requirement for storing the auxiliary array
  6. Merge sort is suitable for any type of array.
  7. merge sort is more efficient than Quick Sort.
  8. Merge sort does not use pivot element for performing the sorting.
  9. It is the external sorting merhod because the data that has to sorted can not be shows in maim memory at the same time and some has to be kept in Auxilliary Memory.


Differentiate depth first search and breadth first search.

Answer :-

Depth First Search : – In short Depth first search called as DFS .DFS is an algorithm for traversing or searching tree or chart information structures. The algorithm begins at the root node and investigates beyond what many would consider possible along each branch before backtracking.

Breadth First Serch :- In short Breadth First Search is called as BFS. BFS is a traversing algorithm where you should begin traversing from a chose hub and cross the graph layerwise in this manner investigating the neighbor (nodes which are straightforwardly associated with root node). You should then move towards the following level neighbor nodes.

Difference between Depth first search and Breadth first search


  1. BFS visit node level by level.
  2. BFS uses queue data structure for performing this action.
  3. Breadth first search is slower than Depth first search.
  4. It require more memory.
  5. In this backtracking is not allowed.
  6. Breadth first search is a optimal choice for finding the shortest thing.


  1. DFS visit node depth wise.
  2. Depth first search uses stack data structure for performing operation or searching.
  3. It is faster than BFS.
  4. It require less memory as compare to Breadth first search.
  5. Backtracking is allowed.
Q-17. (a) – Write a program where pointer point a structure.

Answer : –

You can see below a simple program of a student named structure in which we take input from user name and age using structure and pointer and display the output.

#include <stdio.h>struct student{   int age;   float weight;};void main(){    struct student *stuPtr, stu1;    stuPtr = &stu1;       printf("Enter age: ");    scanf("%d", &stuPtr->age);    printf("Enter weight: ");    scanf("%f", &stuPtr->weight);    printf("Displaying:\n");    printf("Age: %d\n", stuPtr->age);    printf("weight: %f", stuPtr->weight);}    


Enter age: 21Enter weight: 50.650DisplayingAge: 21Weight: 50.650000
Q-17 (b).- Explain stack in brief.

Answer :-


Stack is a linear data structure where insertion of elements or deletion of elements is done from only one side/back end (last) which is called top of the stack.

Stack are also called as LIFO (Last In First Out) or First In Last Out (FILO).

The alternative name of stack in Push Down List.

There are mainly two operations in the stack.

  1. Push
  2. Pop


Push is an operation used to insert an element at the top. Before pushing any element we must check whether there is space in the stack or not.

We can say that insertion of elements or disk.


Pop is an operation used to delete an element from the top of stack.


Q17 (a) – Write a program to find out factorial using recursion.

Answer :-

Recursion : – recursion is a process in which a function call itself while break condition false.

A simple program to find factorial of a Number using using recursion

#include<stdio.h>long int factorial(int n);int main() {    int n;    printf("Enter a positive integer: ");    scanf("%d",&n);    printf("Factorial of %d = %ld", n, factorial(n));    return 0;}long int factorial(int n) {    if (n>=1)        return n*factorial(n-1);    else        return 1;}
Q-17.(b) – Explain queue in brief.

Answer :-

Queue is a linear data structure(Like: straight), in which elements are inserted from the back(rear) end and deleted from front end. The front end of queue is called as front or head and the back end of queue is called rear or tail point of queue.

Queue is based on FIFO (First In First Out) operation. This means that the element which is inserted first in it is also deleted first.

there are two process in Queue

  1. Enqueue – When an element is inserted in Queue, it is called Enqueue.
  2. Dequeue – When an element is deleted from queue, it is called Dequeue.

Q-18. Differentiate entry control loop and exit control loop with suitable example.

Answer :-


When we want to run any command continuously in our program, we use a loop. Loop is also called as iteration or repetition concept.

There are two types of loops.

  • Entry Control Loop
  • Exit Control Loop

Entry Control Loop

Loops that are based on entry command when the condition is true then the compiler goes into the body of loop otherwise exit from loop this type of loops are called as Entry control loop.

Example :- for loop and while loop.

for loop

for loop is a pretested and determinate type loop, it tests condition first then goes into the body part of loop. otherwise exit from loop. here are some properties of for loop.

  • It first debugs the initialization code.
  • Then for loop checks the condition.
  • If the condition is true, it executes the for loop body.
  • Then it evaluates the increment/decrement condition in the third part of for loop and again follow from step 2.
  • When the condition expression becomes false, the compiler exits the for loop.

The syntax of for loop

for (initializationStatement; testExpression; updateStatement){    // statements inside the body of loop}

while loop

while loop is also works like for loop but here is a little difference that it is indeterminate loop it means that programmer does not know knows about repetition count.

Syntax : –

while (condition) {             statements;}

Exit Control Loop

Loops that are executed at least once and then check the condition is called ad Exit Control Loop. In C language here are only one exit control loop is available “do-while”.

do-while loop

This is a posttest loop in c language because it runs at least one time than check the condition is true of false that is the reason why it is called as posttest loop.

If the next condition is true then is will execute again else exit from the loop.

Syntax : –

do{    //Statements }while(condition test);


Define string. Write a program to find out a string is palindrome or not.

Answer :-


We know that in general, we can say a word or sentence is called a string but in C language a “chain of characters” is called a string means a string made by multiple characters.

We also can say it “character array” because by using the array concept we can use string in C language.

  • Format specifier of String is %s.
  • String stop on the NULL character.
  • White space keys are stored as Null. to solve this problem C language provides a function called gets() to input a string with white spaces keys(Enter,Tab,Space).
  • We need an character array for take input of string because it is in character form.
/* C Program to Check the given string by user  is Palindrome or not */ #include <stdio.h>#include <string.h> void main(){  	char str[100];  	int i, length, status=0;   	printf("\n Please Enter any String :  ");  	gets(str);  	  	length = strlen(str); /* strlen()is a function to calculate string length */  	 	   	  	for(i = 0; i < length; i++)	{		if(str[i] != str[length - i - 1])		{			status = 1;			break;			} 	}	if(status == 0)	{		printf("\n %s is a Palindrome String", str);	}	else	{		printf("\n %s is Not a Palindrome String", str);	}	}


Please Enter any String : abcbaabcba is a Palindrome String

So friends, we were very happy to help you, if you liked the work of our website, do let us know by commenting.

What are you thinking about this article “C-Programming and D S – B.Sc. IT first (1) year 2018 Solved Paper” Please share this article with your friends of B.Sc.IT students. C programming solved paper is very useful for every BSc IT student.