[PDF] Indian Institute of Technology Kharagpur





Previous PDF Next PDF



Indian Institute of Technology Kharagpur

30 Sept 2013 Questions have been shuffled across different question papers. 7. No ... c * y / z + y / z * c)); printf("Expr_2 = %lf " x - s * t * - c ...



Model Question Papers

28 Nov 2018 ... C suitable program. Explain each of the parameter it takes in detail. 6 CO5 L3. 1.4.1. 7(c) A file consists of binary data. Write a program to ...



Question Paper EN : JAM 2023

(C) If ′( ̅) < the firm will sell some of its capital. (D) If ′( ̅) =



IIT MADRAS ZANZIBAR SCREENING TEST 2023

For Question 5 and 6 select the one word that has nearly the same meaning as the italicized word in the context of the sentence. Questions 7-10 are based 



SECTION – A

the full employment output equals 1000 the full employment equilibrium price level in the economy is . (in integer). END OF THE QUESTION PAPER.



Indian Institute of Technology Kharagpur

2 Sept 2013 Answer all questions in the space provided in this question paper itself. ... Consider the C program below (with gaps to be filled in) to perform ...



Introduction to C Programming

16 Feb 2023 ... question papers for the course (duration 03 hours). 1. The question paper will have ten questions. Each question is set for 20 marks. 2 ...



Indian Institute of Technology Kharagpur

25 Nov 2013 This question paper comprises 6 questions in 16 pages (8 sheets). 01 ... (c) Fill up the missing codes in the function below where void Swap ...



Model Question Paper for the M.Tech. Admissions Test

Disclaimer about this document: This question paper is a model for the admissions-test to IEOR depart- ment at IIT Bombay. C. Communication skills play a ...



C programming for Problem Solving[18CPS13/23] QUESTION

C programming for Problem Solving[18CPS13/23]. QUESTION BANK PREAPRED BY: Dr.Jyoti Metan. Module 1 : Introduction to Computer Hardware & Software. Sl. No.



Indian Institute of Technology Kharagpur

30-Sept-2013 Questions have been shuffled across different question papers. ... (c) What will be the output of the program if nMax is initialized to 2K ...



Indian Institute of Technology Kharagpur

25-Nov-2013 Programming and Data Structures (CS 11001). Students: 700 ... This question paper comprises 6 questions in 16 pages (8 sheets).



3rd-sem-object-oriented-programming-using-c-computer-sample

Sample Question Paper. Program Name. : Computer Engineering Program Group. Program Code. : CO/CM/IF/CW. Semester. : Third. Course Title.



PROGRAMMING FOR PROBLEM SOLVING DIGITAL NOTES B

C is a high-level language used for system software and new application code. ALGORITHM: Algorithms was developed by an Arab mathematician. It is chalked out 



BCA-I-II-III-YEAR.pdf

BCA-103 Programming in C++ The question paper contains 3 sections. ... Examiner will prepare question paper of Practical Examination.



1 of 28

C. This logo can be reproduced as shown above by using a four colour screen printing process. D. The visual properties of the English font match the 





IIT ASHRAM BRINGS SAMPLE PAPER - Vadodara

The question paper consists of 4 Sections. If A is B's brother B is C's sister and C is D's ... Pre-Foundation Program for 6th



Online BSc Degree and Diploma Program

02-Nov-2020 IIT Madras India's top technical institute



IIT ASHRAM BRINGS SAMPLE PAPER

The question paper consists of 4 Sections. are marked a b



Programming in C: Basics - IIT Kharagpur

Programming in C: Basics CS10001: Programming & Data Structures Dept of CSE IIT KGP Pallab Dasgupta Professor Dept of Computer Sc & Engg Indian Institute of Technology Kharagpur



Model Question Paper C-PROGRAMMING FOR PROBLEM SOLVING (18

question we try to verify it by writing iterative and recursive code for the following image Consider the functions drawSquareIter and drawPatternRec Both create the same final image drawSquareIter is an iterative function whereas drawPatternRec is a recursive one (a) Following is the incomplete code for the function drawSquareIter Fill



CS8251 - PROGRAMMING IN C UNIT-I PART A

3 Write any two preprocessor directives in C Preprocessor directive instructions are used to instruct the preprocessor to expand/translate the source program before compilation The two types of preprocessor directives are #define to define Macro Global constant #include to include library files 4



Model Question Paper C-PROGRAMMING FOR PROBLEM SOLVING

Model Question Paper I/II Semester C-PROGRAMMING FOR PROBLEM SOLVING (18CPS13/23) Time: 3 hrs Max Marks: 100 Note: Answer any FIVE full questions choosing one full question from each module MODULE 1 1 a Explain different types of computer (6Marks) b What is Software? Explain different types of software (6 Marks) c



Programming in C - IIT Kharagpur

• C is a general-purpose structured programming language – Resembles other high-level structured programming languages such as Pascal and Fortran-77 – Also contains additional features which allow it to be used at a lower level • C can be used for applications programming as well as for systems programming



Searches related to iit c programming question papers filetype:pdf

programming for Problem Solving[18CPS13/23] QUESTION BANK PREAPRED BY: Dr Jyoti Metan Module 1 : Introduction to Computer Hardware & Software Module : II Branching & Looping Module : III Array and Strings Module IV : Functions & Recursion Module: V Structures Pointers Preprocessor Directives

How long is model question paper I/II?

    Model Question Paper I/II Semester C-PROGRAMMING FOR PROBLEM SOLVING (18CPS13/23) Time: 3 hrs. Max. Marks: 100 Note: Answer any FIVE full questions, choosing one full question from each module.

How long is model question paper Programming in C and data structures?

    Model Question Paper PROGRAMMING IN C AND DATA STRUCTURES Model Question Paper PROGRAMMING IN C AND DATA STRUCTURES (14PCD13/14PCD23) Time: 3 hrs.

How long is C-programming for problem solving (18cps13/23)?

    Model Question Paper C-PROGRAMMING FOR PROBLEM SOLVING (18CPS13/23) MODULE 1 OR Model Question Paper I/II Semester C-PROGRAMMING FOR PROBLEM SOLVING (18CPS13/23) Time: 3 hrs. Max. Marks: 100 Note: Answer any FIVE full questions, choosing one full question from each module.

Indian Institute of Technology, Kharagpur

Department of Computer Science and Engineering

End-Semester Examination, Autumn 2013-14

Programming and Data Structures (CS 11001)

Students: 700Date: 25-Nov-13 (FN)

Full marks: 100Time: 3 hoursNameRoll No.SectionQuestion No.123456Total

Maximum401510101510100

MarksMarksObtained

EvaluatorPGSDJMDSPPDAG

This question paper comprises 6 questions in 16 pages (8 sheets)01Instructions: 1. W ritey ourname, roll n umberand section in the space ab ove. 2. On the top of ev eryo ddpage write y ourroll n umber. 3. Answ erall questions in the space pro videdin this pap eritself. No extra sheet will b epro vided. 4.

Use the designated spaces for rough w ork.

5. Marks for ev eryquestion is sho wnwith the question. 6. No further c laricationsto an yof the questions will b epro vided.1

1.Answ erthe follo wingquestions:

(a) Con vert6f2.5bc(in hexadecimal system) to the octal number system. [2 marks]Answer: 3362.2674 Note for Marking: 1 mark for the integral part and 1 mark for the fractional part. (b) Con vert129.5625(in decimal system) to the hexadecimal system. [2 marks]Answer: 81.9 Note for Marking: 1 mark for the integral part and 1 mark for the fractional part. (c)

Represen t-77(in decimal system) in binary 8-bit signed-magnitude, 1's complement, and 2's complement

representations. You need not show the steps of conversion. [1 * 3 = 3 marks]Answer: -77 = 11001101 (Signed Magnitude) -77 = 10110010 (1's Complement) -77 = 10110011 (2's Complement)

--------(d)Y ouare ask edto generate the follo wingalternating v ariantof the Fib onacciseries fa(n),n0:

0;1;1;2;3;5;8;13;

i. Sp ecifythe base conditions (on n) and the recursive expression forfa(n) in every case to complete the recurrence forfa(n): [(0.5 + 0.5) + (0.5 + 0.5) + (1.5 + 0.5) = 4 marks]Answer: f_a(n) = 0, for n = 0 [Base Condition 1] = -1, for n = 1 [Base Condition 2] = f_a(n-2) - f_a(n-1), for n > 1 [Recurrence]

------------------- -----Note for Marking:Conditions (onn) must be exact. Any equivalent expression forfa(n)(like

f a(n) =n, forn= 0orfa(n) =n, forn= 1) is acceptable in every case. No partial marking in case of the expression forn >1. 2

Roll No:

ii. Complete the follo wingco desegme ntthat prin tsfa(n) forn= 0;1;2;;m: [1 + 2 + 1 = 4 marks]Answer: void f_a(int m) { int n, x = 0, y = -1; for(n = 0; n < m; ++n) { int t = y; printf("f_a(%d) = %d\n", n, x); y = x - y; x = t; }Note for Marking:y = x - t(or any equivalent expression) is acceptable in place fory = x - y. (e)FindMinMaxis a function that takes an arrayAofintand the number of elementsninAas input and returns the minimum as well as maximum values inAthrough parameters. i. Fill up the parameter t ypesi nthe protot ypeof FindMinMax. [1 * 2 = 2 marks]Answer: void FindMinMax(int A[], int n, int* min, // Parameter for minimum value int* max); // Parameter for maximum value --------Note for Marking: Just the data typeint*is acceptable as an answer. Variable names should be ignored for marking. ii. If int minandint maxare variables to hold the minimum and the maximum values respectively of

int X[], write a call toFindMinMaxto match the above prototype. [0.5 * 2 = 1 mark]Answer: FindMinMax(X, n, &min, &max);

---- ----iii.Alternativ ely,if th er eturnt ypeof FindMinMaxisintas in the following prototype, ll up the data

types in the prototype and the details in the call toFindMinMax? [0.5 * 4 = 2 marks]Answer: // Returns the minimum value as function return value // and the maximum value through parameter int FindMinMax(int A[], int n, int *max); // In the caller - int min and int max hold the minimum and // the maximum values respectively for int X[] min = FindMinMax(X, n, &max); --- ----3 (f)Consider the follo wingco desnipp et: p = (int *)malloc(sizeof(int)); q = &p; r = &q; i. W ritethe data t ypesof p,q, andr. [1 * 3 = 3 marks]Answer: int * p; int ** q; int *** r;

-------ii.Sho who wto allo catean arra yof 20 p ointers(of ap propriatet ype)to r? [1 * 2 = 2 marks]Answer:

r = (int ***)malloc(20*sizeof(int **));

------- -----------------Note for Marking:Any equivalentsizeofexpression like20*sizeof(*r)or20*sizeof(r)or

20*sizeof(int *)or20*sizeof(void *)or any expression using the size of a pointer variable

would be acceptable. However, machine-dependent expressions like20*4or80would not be acceptable. (g) Y ouare sorting th efollo wingarra yin ascending order using InsertionSort.62713 Show the contents of the array after every iteration of the sort (Iteration 0is the input array). [1 * 4 = 4 marks]Answer: Index

Iteration01234

062713

126713

226713

312673

412367

Note for Marking:Award mark if all elements of the array are correct after each iteration. 4

Roll No:

(h) Data are pushed to ( PUSHoperation) and popped from (POPoperation) a stack in the following order: PUSH 3; TOP; PUSH 7; TOP; PUSH 6; PUSH 9; TOP; POP; POP; TOP; where thePUSH,POPandTOPoperations of stack behave as discussed in the class. Write the values returned byTOPfor the sequence of operations above. [0.5 * 4 = 2 marks]Answer:

3 7 9 7

- - - -(i)A stac kof intis implemented using an array as the following data type: #define SIZE 20 typedef struct { int data[SIZE]; int top; } Stack; Fill up the missing codes in thePUSH,POP, andTOPoperations of the Stack. [1 * 3 = 3 marks]Answer: void Push(Stack *s, int d) { s->data[++s->top] = d; void Pop(Stack *s) { --s->top; int Top(Stack *s) { return s->data[s->top]; }Note for Marking:Equivalent pointer de-referencing expressions like(*s).datain place ofs->data

are acceptable as long as they are correct and are expressed in single expressions. Hence, statements like

++s->top; s->data[s->top] = d;are not acceptable in place ofs->data[++s->top] = d;. 5

(j)Data are enqueued to ( ENQoperation) and dequeued from (DEQoperation) a queue in the following order:

ENQ 3; FRONT; ENQ 7; FRONT; ENQ 6; ENQ 9; FRONT; DEQ; DEQ; FRONT; where theENQ,DEQandFRONToperations of queue behave as discussed in the class. Write the values returned byFRONTfor the sequence of operations above. [0.5 * 4 = 2 marks]Answer:

3 3 3 6

- - - -(k)A queue of intis implemented using a circular array as the following data type: #define SIZE 20 typedef struct { int data[SIZE]; int front, rear; } Queue; Fill up the missing codes in theIsEmptyandIsFulloperations of the Queue. [2 * 2 = 4 marks]Answer: int IsEmpty(Queue *q) { return q->front == q->rear; int IsFull(Queue *q) { return q->front == (q->rear+1) % SIZE; }Note for Marking:Allow 1 mark each for the two sides of==in the expressions. Deduct 0.5 mark if=is written in place of==. Deduct 1 mark if!=is written in place of==. Equivalent pointer de- referencing expressions like(*q).frontin place ofq->frontare acceptable as long as they are correct and are expressed in single expressions. No other partial marking is allowed. 6

Roll No:

2. Consider the follo wingp olynomialP(x) of degreeninx:P(x) =anxn+an1xn1++a0=Pn i=0aixi We can representP(x) as a pair of variables { degreenand an arrayaof its coecients as: #define MAX_POLY_SIZE 100 // Maximum degree double a[MAX_POLY_SIZE+1]; // Array of coefficients unsigned int n; // Degree of polynomial (a)EvalPolytakes a polynomialP(x) (degreenand coecient arraya) andxas input and returns the value of the polynomialP(x) atx. Fill up the missing codes in functionEvalPoly. [1 * 2 = 2 marks]Answer: double EvalPoly(double a[], // Array of coefficients unsigned int n, // Degree of polynomial double x) { // Value of unknown x for evaluation double val = 0.0; // Value of the polynomial double pow_x = 1.0; // Powers of x unsigned int i; // Index for(i = 0; i <= n; ++i) { val += a[i]*pow_x; // Accumulate the next term pow_x *= x; // Compute the next power of x return val;

}Note for Marking:Any equivalent expression like interchanging of operands of multiplication (likeval

+= powx*a[i];) are acceptable in place ofval += a[i]*powx;. Array indexing by pointer expressions like*(a+i)fora[i]is also acceptable.powx = powx * x;or any expression equivalent to it is also acceptable in place ofpowx *= x;. (b) The ab ovep olynomialcan b ewritten in a fully paren thesizedform (kno wnas Horner's Form) as: P(x) =anxn+an1xn1++a0= ((((anx+an1)x+an2)x+an3)x+)x+a0

Complete the following implementation ofEvalPolyusing the Horner's Form. [0.5 * 4 + 1 = 3 marks]Answer:

double EvalPoly(double a[], // Array of coefficients unsigned int n, // Degree of polynomial double x) { // Value of unknown x for evaluation double val = 0.0; // Value of the polynomial unsigned int i; // Index val = a[n]; // Initial value for(i = n; i > 0; --i) { val = val*x+a[i-1]; // Iterative accumulation of value return val; }Note for Marking:Array indexing by pointer (like*(a+i)fora[i]) and re-ordering of operands (like

0 < ifori > 0), equivalent expressions (likei--for--i) are acceptable if correct.

7 (c)Complete the function AddPolyto add two polynomialsaandb(as degree and coecient array pair) and generate a sum polynomialc: [1 * 5 = 5 marks]Answer: unsigned int // Degree of the sum polynomial

AddPoly(

double a[], unsigned int m, // First polynomial double b[], unsigned int n, // Second polynomial double c[]) { // Coefficients of the sum polynomial unsigned int i = 0; // Index while (i <= m && i <= n) // Add common terms c[i++] = a[i]+b[i]; while (i <= m) // Handle extra terms of first polynomial c[i++] = a[i]; while (i <= n) // Handle extra terms of second polynomial c[i++] = b[i]; return (m > n)? m: n; // Return the degree of sum polynomial }Note for Marking:Array indexing by pointer (like*(a+i)fora[i]), re-ordering of operands (likem >= ifori <= m) are acceptable if correct. Return value may bei-1or--iin place of(m>n)?m:n. (d) Consider the function EvalPolyDerivativethat takes a polynomialP(x) (degreenand coecient array a) andxas input and returns the value of the derivativedP(x)=dxatx. For example, ifP(x) =

7x32x2+ 5x+ 2,EvalPolyDerivativewill evaluateP0(x) = 21x24x+ 5. Fill up the missing codes

inEvalPolyDerivative. You may use the functions written above. [1 + 2 + 1 * 2 = 5 marks]Answer: double EvalPolyDerivative( double a[], // Array of coefficients unsigned int n, // Degree of polynomial double x) { // Value of unknown for evaluation unsigned int i; // Index double b[MAX_POLY_SIZE]; // Array of coefficients of // derivative polynomial for(i = 0; i < n; ++i) { b[i] = a[i+1]*(i+1); // Perform derivative return EvalPoly(b, n-1, x); // Evaluate derivative polynomial }Note for Marking:Array indexing by pointer (like*(a+i+1)fora[i+1]), re-ordering of operands (like n > ifori < n) are acceptable if correct. 8

Roll No:

3.

It is required to ll up a 2D ar rayAwith a zigzag pattern that starts from the left-top corner with00. The

numbers are lled up sequentially along the anti-diagonals with the direction alternating betweenup(from

south-west (SW) to north-east (NE):01 --> 02) anddown(from NE to SW:03 --> 04 --> 05) as follows:Answer:

00 02 03 09 10 XX 21

(20) --

01 04 08 11 XX

(19)

05 07 12 XX

(18)

06 13 XX

(17) 14 XX (16) 15 --ROUGH WORK

Use this space for your rough work, if any.

This part will not be evaluated.(a)Study the ab ovepattern care fullyand ll u pth edashed v alues.Y ouneed to c omputethe v aluesmark ed

asXX, but you do not need to write them. There is no separate credit for writingXX's. [1 * 2 = 2 marks]

(b)

Fill up the mis singco desb elowto generate the ab ovepattern in ar rayAin the order mentioned above:

[1 * 8 = 8 marks]Answer: int A[20][20]; // The 2D Array int n = 10; // Number of anti-diagonals to fill int val = 0; // Next value to fill up. Starts with 0 int dir = 1; // Direction of fill up. dir = 1 means direction is downward // from north-east (NE) to south-west (SW), 0 otherwise int i, j; // Indices int k; // Anti-Diagonal control index for(k = 0; k < n; ++k) { // Control the diagonal to fill for(i = 0; i <= k; ++i) { // One index of A j = k - i; // Other index of A if (dir) // Decide direction and choose fill location A[i][j] = val++; // Downward fill. From north-east to south-west else A[j][i] = val++; // Upward fill. From south-west to north-east dir = 1 - dir; // Change direction }Note for Marking:Equivalent expressions like(dir)?0:1that takes0to1and1to0are acceptable in place ofdir = 1 - dir. Re-ordering of operands (likek >= ifori <= k) are acceptable if correct. 9

4.The follo wingquestions use a link edlist consisting of no desas:

typedef struct Node_ { char data; struct Node_ *next; } Node;

VariableNode *head;holds the header of the list.

(a) Compute FindSpecialChar(str)forstr = "merge", "memory",and"recursion"to get an idea for what the functionFindSpecialChar(str)does. State the output (return value) ofFindSpecialChar(str) in words for a givenstr. [1 + 1 + 1 + 2 = 5 marks]#include #include #include char FindSpecialChar(char *str) {

Node *head = (Node *)malloc(sizeof(Node));

Node *p = head;

Node *q = 0, *r = 0;

int i, n = strlen(str); // Form a list with the characters of the string for(i = 0; i < n - 1; ++i) { p->data = str[i]; p->next = (Node *)malloc(sizeof(Node)); p = p->next; p->next = 0; p->data = str[n - 1]; // Find a special character q = p = head; while (p) { p = p->next; if (p) { p = p->next; q = q->next; return q->data; }ROUGH WORK

Use this space for your rough work, if any.

This part will not be evaluated.Answer:

For input "merge", the output is: r

For input "memory", the output is: o

For input "recursion", the output is: r

Given str, the output is: the middle character in str

---------------------------Note for Marking: Separate explanations for strings of odd and even lengths are acceptable as long as

middle characteris mentioned. 10

Roll No:

(b) Y ouneed to write Node *ReverseList(Node *p)to reverse the nodes in a given linked list. That is, head = ReverseList(head); will take a list held byhead, reverse it and put back tohead. Fill up the missing codes inNode *ReverseList(Node *p)below. [1 * 5 = 5 marks]Answer:

Node *ReverseList(Node *p) {

if (!p) return 0; if (p->next) {

Node *q = ReverseList(p->next);

p->next->next = p; p->next = 0; return q; return p; }Note for Marking:NULLin place of0is acceptable. De-referencing expressions like(*p).nextin place ofp->nextare acceptable if correct. 11

5.The function int *Place(int *left, int *right);takes two pointersleftandrightto two locations in

an array, sayA, ofintsuch that the index valuelIndexof the element pointed to byleftis less than the index valuerIndexof the element pointed to byright. Clearly,left = &A[lIndex],right = &A[rIndex] andlIndex < rIndex. Assume that the elements inA[]are all distinct. int *Place(int *left, int *right)places the elementnum = A[lIndex]pointed to byleftat a position pIndex(lIndex <= pIndex <= rIndex) such that all elements betweenA[lIndex]andA[pIndex-1]are less thanA[pIndex]and all elements betweenA[pIndex+1]andA[rIndex]are greater thanA[pIndex]. The functionint *Place(int *left, int *right)does not disturb any element outside the range ofA[lIndex] .. A[rIndex]and returns&A[pIndex]after the placement.

For example, forA[] =

0 1 2 3 4 5 6 7 8 9 10 1154107391211681314

lIndex = 2andrIndex = 8(left = &A[2]andright = &A[8]),int *Place(int *left, int *right) placesA[2] = 10at&A[6], setsA[]as

0 1 2 3 4 5 6 7 8 9 10 1154673910111281314

computespIndexas6and returns&A[6]. (a) Express the follo wingin terms of left,right, andAonly. [1 * 4 = 4 marks]Answer: lIndex = left - &A[0] rIndex = right - &A[0]

A[lIndex] = *left

quotesdbs_dbs5.pdfusesText_9
[PDF] ikea cigna

[PDF] il 1040 form 2018 pdf

[PDF] il area code map

[PDF] il est en cours de cheminement

[PDF] il faut être de son temps translation

[PDF] il y a combien de continents

[PDF] il y a combien de mois dans une annee

[PDF] il y a combien de personnes dans ta famille

[PDF] ile de france nombre de deces covid

[PDF] ile kcal ma cheeseburger z mc

[PDF] iliad pronunciation guide

[PDF] illegal activities in hotel rooms

[PDF] illegal apartment eviction

[PDF] illegal apartment nyc tenant rights

[PDF] illegal apartment?