BT0065 - C Programming and Data Structures


Dear students get fully solved assignments
Send your semester & Specialization name to our mail id :
“ help.mbaassignments@gmail.com ”
or
Call us at : 08263069601
(Prefer mailing. Call in emergency )


ASSIGNMENT

WINTER
2013
PROGRAM
BSc IT
SEMESTER
FIRST
SUBJECT CODE & NAME
BT0065, C Programming and Data Structures
CREDIT
3
BK ID
B0950
MAX. MARKS
60



Note: Answer all questions. Kindly note that answers for 10 marks questions should be approximately of 400 words. Each question is followed by evaluation scheme.



Q.1Compute the values of a and b:
int a;
int b;
a=1;
b=a++;
a. What value does the variable b have after ALL of the code above executes?
b. What value does the variable a have after ALL of the code above executes?

Answer:-
(a)    The  value of variable b have after ALL of the code above executes:-
b=1

(b)   The  value of variable a have after ALL of the code above executes:-
a=2
2Compute the values of X and Y.

a. What value does the variable z have after ALL of the code above executes?
b. What value does the variable y have after ALL of the code above executes?

Answer:-
(a)                The value of variable b have after ALL of the code above executes:-



(b)               The  value of variable b have after ALL of the code above executes:-


Q.2Write a program and draw a flowchart to print 1 to 100 all natural numbers.

Answer:-
#include<stdio.h>
#include<


Q.3Explain while and do-while statement with an example.

Answer:-WHILE - WHILE loops are very simple. The basic structure is

while ( condition ) { Code to execute while the condition is true } The true represents a boolean expression which could be x == 1 or while ( x != 7 ) (x does not equal 7). It can be any combination of Boolean statements that are legal. Even, (while x ==5 || v == 7) which says execute the code while x equals five or while v equals 7. Notice that a while loop is like a stripped-down version of a for loop-- it has no initialization or


Q.4Distinguish library functions and user defined functions.

Answer:-library functions :- A library function has been written by someone else, and is reusuable by many programmers to solve the same problem over and over.  standard fuction is pre define fuction like getch(),clrscr(), in c++ and These functions are also called as 'library functions'. These functions are provided by system. These functions are stored in library files. e.g.

scanf()



Q.5 Convert the following infix expressions into postfix showing stack status at each step.
1. a+b*c-d/e*f                                                                                                                 
2. a+(b*c) –d

Answer: -In order to convert infix to postfix expression, we need to understand the precedence of operators first.

Precedence of Operators
There are five binary operators, called addition, subtraction, multiplication, division and exponentiation. We are aware of some other binary operators


Q.6 what is spanning tree? Explain Prim’s algorithm for minimum spanning tree.

Answer: -spanning tree:- In the mathematical field of graph theory, a spanning tree T of a connected, undirected graph G is a tree that includes all of the vertices and some or all of the edges of G.






Prim’s algorithm for minimum spanning tree:-Prim's algorithm closely resembles Dijkstra's algorithm because they both rely on a similar approach of finding the "next closest" vertex. Prim's algorithm slowly grows a minimum spanning tree, starting from
Dear students get fully solved assignments
Send your semester & Specialization name to our mail id :
“ help.mbaassignments@gmail.com ”
or
Call us at : 08263069601
(Prefer mailing. Call in emergency )

No comments:

Post a Comment

Note: only a member of this blog may post a comment.