Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
36 views
10 pages
COMPUTER
C programming pyq
Uploaded by
Aman Singh
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save COMPUTER-Copy For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
36 views
10 pages
COMPUTER
C programming pyq
Uploaded by
Aman Singh
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save COMPUTER-Copy For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save COMPUTER-Copy For Later
You are on page 1
/ 10
Search
Fullscreen
Time: NOTE: 1) Answer to the point and make assumptions wherever required and clearly state them. Hrs] FEB 2023 EXAMINATION 1 B.Tech. (4YDC) EXAMINATION C010504/ CO10507: PROGRAMMING FOR PRPBLEM SOLVING ‘TOTAL NO. OF QUESTIONS IN THIS PAPER: 5 1086 [Max. Marks: 70 2) Attempt all parts of same question at one place and each question carries five sub parts a, b, c,d, €, Part a, by cis compulsory and attempt any one from d and e. Question No. a1 @ ) © @ © Q2 (@) @) © @ © a3 @) 0 (iy Gi) Question Differentiate between: i) Source code file and executable cade file ii) Keywords and Identifiers, Identify the most appropriate answer ofthe following i) ‘command is used to rename a file in linux environment, ii) Computers use the _ language to process dats, ) Scanner and Mouse are examples of___ types of devices. iv) Internet Explorer is an example of _~ software. (System/Application) Answer the following: () How many bits are there in the following - byte, megabyte, and gigabyte? i) Enlist the name of Linux commands that are used for development of the program using C language. Draw a flowchart to check whether the given integer number is @ prime number or rot, In flowchart handle all eases of the number ie. negative number, positive rnurnber and non-integer. How run-time error is different from compile-time errors? oR Drew a flowehart to calculate the sum of series. Sin(x) = x07 3148751 1771 ta What isa veriable? Explain the ways to declare scope of a variable, Differentiate between type casting and type conversion with the help of an example. Identify the most appropriate answer of the following: + i) ___ isthe range of values that can be stored by int datatype in C. ii) Risaiypeof, ‘operator. iid) isthe number of whitespace characters allowed in C language. ivy) case is matched in a switch statement, when all cases. are ‘unmatched Write a program that prints a table with each line giving an integer, its square, and its cube. Ask the user to input the lower and upper limits forthe table, Evaluate the expressions for the following, assume that the variables are declared and initialized as follows: intx= 3, y=4,2= 5; float a= 2.5,b=3.5,0= 4.5; A 1) (Moat) * y %x)* y/2]z4 x: Heed abet y/ xt bs i) yell xP ae tx B& ZS"; oR Write a programeto find the difference of two dates in years, month, and days. Find ‘whether the entered dates are valid or-not. Assume that the first date falls before second date. ‘What is an infinite loop? Write the syntax of infinite loop using for loop. Ca a os a a 2 07 a cor cor cor col cor co cor cor coz cos Bri BT Bra BIB Br Br Bra Br Br Br2 Br BI Br? Marks CO’ BT PL 1d 1nd La wd wa na 1nd 124 252 aaa4 © © @ © @ ) © @ © Explain the output of the following C code with proper justification? include
int main()¢ for = 251< 105 144) { for =25)<= 535+) FORD) break ind> GD) print is) return 0s } Write the following function in a recursive manner. int funetioncint n) { int sum: int eount=15, while(count
int maing Sh printi("%an", ptr); print %6ld\n*, pte2-perl) printi96din", Mare+4))s return 0; } Differentiate between call by value and call by reference with the help of an ‘example, Write @ program using function reverse (), that takes @ striig as argument and reverses only a portion ofthe string using pointers. Consider @ 1-D array of integers 0°s and I's. Write a program which reads the 0/1 array having n (<20) elements and then prints the length of the longest sequence of Vs, Example , if the input aray is int are{15}= (0,1,0,1,1,0,0,,141,1,0,1,0,1} the length of the longest run of I's is 4 or A record of “a” employee using an array of structures with four fields (empld, fename, age, salary) is maintained. Fach field is of an appropriate data type. Write @ program to store records of this structure in a file and sort them on the basis, a 0 7 o7 o 0 03 o7 o7 cos co3 co3 cot cou cow cow Bra 252 BTA 3.82 BIS 3.82 BT3 3.82 BTS 252 BI2 171 BTS. 45.1 BTS 45.1 BI3. 45.1Qs () ib) © @ © of empfd and name. ‘Compare and contrast the structured programm programming. Explain the visibility of base class members for the agcess specifiers: private, protected, and public, Differentiate between the following: (i) Function overloading and Operator overloading. (Gi) Abstinetion and Encapsulation Create a class named Shape with a funetion that prints "This is a shape", Create another class named Polygon inheriting the Shape class withthe same function that prints "Polygon isa shape’. Create two other classes named Rectangle and Triangle nfs "Rectangle is a polygon” and "Triangle is a and object oriented polygon’ respectively oR Implement a class ‘printdata’ with two-member functions all with the same name “print void print(int)— outputs value ~, that is, value followed by the value ofthe integer ‘void print (int, int) outputs value ~[, ], that i, value followed by the two tegers separated by a comma in square brackets. ‘Writea main function that uses the above class and its member functions. a 03 7 7 cos BT2 cot BT2 cot Br2 cod BTS cot BTS 1nd 1nd 1nd 45.1 4S.Online Feb. 2022 EXAMINATION 1B.E,/ B.Tech (4YDC) EXAMINATION CO 10504: COMPUTER PROGRAMMING ‘Time: 90 Mins.) TOTAL NO. OF QUESTIONS IN THIS PAPER: 5 NOTE: 1) Answer to the point and make assumptions wherever required and clearly state them. 2) Attempt all parts of same question at one place and each question carries two sub parts a and b. Attempt any one from a and b. 224 (Max. Marks: 40 Question | Quest Marks|CO. [BL No. 2.1 |(@) |( |Soivele following: 04 [cO! [BL2 Dy (1834342), (C3E.C4B) a = (ii) | Draw eT Isum of squares of all even numbers between 2| 04 |CO1 |BL2 0 500 (both numbers inclusive). E OR (©) |(@ [Solve the following. 04 [cot [BL3 |) 86.3A2)i6= (he | ii) 62431241 = iii) (231.212) 5= (ii) |Draw a flowchart to find if the given number is a palindromic prime number) 04 |COI |BL2 lor not. 2 |(@) |( |Soive the following for the values int a= 10, b=-15,e=20,d=-6,Z=0; | 04 [COI [BLS 1)Z=a
a%b*-170%2-20:0* 1045; | 3) Z=atStetd
2. a+) Fill up the dashed lines in the program Hinclude
‘int main () ‘ double sum double term int k = a for(; k = 10000; ++) { sum=___; printf("%AlP, sum); return 0; } — (Gi) [Write a recursive function for finding length of strings and display the string) 04 |Co3 |BLs the string in front and reverse order. Q4|(@) |@ | Write a Program using pointers to find whether the two strings are anagram) 04 [CO3 |BL4 Jor not. For Example: LISTEN and SILENT are two anagram strings. (ii) | Given the current time and time required for a class, it is desired to find out] 04 |CO3 [BLS ithe time when the class ends. Write a structure to represent time in hour, ‘minutes, and seconds, Also write a function which gets the current time and| class time, and returns the end time of class. OR (b)|(i) |The absolute distance between two integers x1 and x2 is given by k2-x2.| 04 [Cod |BLa Write a function which sorts an array x{ ] of n integers in ascending order of| their absolute distances with a given number z. For example, given x{ ]= {9, 1, 12, 4, 2} and z=6, the sorted array will be x{ (4, 9, 2, 1, 12}. Note that 4s closest to 6, and 12 is farthest from 6 in terms of absolute distance. The! function Prototype will be: void sort_abs (int x{ ], int n, int z);(ii) | Write a program which uses a structure that read roll number, name, and| 04 |CO4 [BLS percentage of 5 students. If the percentage of the student is greater than 70 then write its information to the file ‘Fl.txt’ otherwise write it to file’ ‘F2.tat’, Q.5 |(a)|(i |Enlist the major differences between procedures oriented and object) 04 |[CO4 [BLA oriented programming languages. (ii) | Differentiate between the following with programming example: 04 |co¢ |BL2, }) Function overloading and Operator overloading BL3 ii) Object and Class iii) Abstraction and Encapsulation OR () | (| Differentiate between the following with programming example: 04 |co4 |BL2, |i) Overloading and overriding BL3 ii) Multiple Inheritance and multilevel inheritance iii) Static binding and dynamic binding lies (i) [Enlist the major advantages of C++ programming language. Justify your! 04 [Coa |BLa answer using a programming example, KXKXX: a2 JUNE-JULY 2022 EXAMINATION 1 B.Teth, (4¥DC) EXAMINATION CO 10504: COMPUTER PROGRAMMING ‘Time: 3 Hrs, Max, Marks :70 [Min Marks :22 TOTAL NO. OF QUESTIONS IN THIS PAPER: 5 NOTE: 1) Answer to the point and make assumptions wherever required and clearly state them, Assume C programming language wherever required. 2) Attempt all parts of same question at one place andl each question eatries five sub parts, bye, d, «Part a, bye is compulsory and attemptany one from d and e, 2.1. (a) Explain now negative numbers are represented in the computer memory? Give one example 02 Con BT? 121 (b) denify the most approprite answer ofthe following. oz cot art wnt iy “are the memory of the CPU, ii) DMB is equivalent to bits iti) __ command is used delete the file in Linux operating system, example of software iv) goa is (6) Draw a flowchart to take four points from user (x.y), (§2392) (X3,y3) and (x4,y4) and find out if 03 COL BT3 252 ‘those points form an parallelogram or not. (2) Diferentate between the Following with the help ofan example: o7 col BT2 171 1) Source code file and exeoutable fle |i) Unary operators and ternary operator ‘ify short int and long int iv) “Type conversion und type easting on © () Solve the following : 07 cor BT3 121 1) (A25.219) y= (7) Gi 63.1532) fil) (1BI23.CA2) = (5 Gv) (341.567), 0.2 (a) What isthe difference between constant using define maero and const keyword? 2 col Bra 17.8 (©) Discuss about iterative statements? What are the different types of iterative statements in C? 2 coz Br 131 (©). What isan identifier (variable)? What are the rues to construct identiier(variabley? Classify the 03 CO2 BIZ 1.7.1 following as validinvalid Identitiers. iy mum? if)Snumt ii) Yad iva 2 y)199_space* vi) apple Evaluate the expressions forthe following, assume thatthe variables are declared and intilized as 07 CO2 BT'S 1.2.1 follows: int 2223 Moat a="I1,b= 22, ¢* 3.3; I) atz%y*(inge/5&&y>x\] H+; : i) HN IDM yt 421644 M6 Re 2 Hil) (x= 2) Hy> bP HAN) RA EL>=S FInt ; . on (€) Write a program which reads an integer n > 10 and areal variable x, 0&jxJ&=1. Compute and print 07 C3 BT4 2.63 ‘he sum of the series upto terms: « = Veta 13s) yteg att SGU ot aga ena a enc tated je ‘The program should NOT use any standard library Function 3 (@) Ditereatite between prin} print) pus}, and Fputs © COS Bra 264 (b) Tabutate the seope and life time of the following : 2 COs BT! 171 (ihEsteral variable (i) Sttie variable (ii) Automatic variable (iv) Register variable (©) Writes € function isprime(murn) that accepts an integer argument and returns lithe arguments 03 CO3 BT4 463 prime or 0 otherwise. Write a program that invokes this function to generate prime numbers between the given ranges. (a) Write a recursive program to calculate the value of aCr. nCr isthe number of ways of selecting 07 CO3 BTA 45.1 items given a ilems, The recurrence for calculating nCr i given by: on Algorithm for multiplication of two positive integers. It works in the 07 COM BTA 46.3 be (©) Consider the Peas{allowing manace. i. Wale the two numbers in two columns. ii, Keep updating according to the following procedure until the number in the first (i. left) column becomes 1 Halve the number in first column (integer division), double the number in the second column, {At the end, sum up all the numbers inthe second column, for which, corresponding number in the fest column is od. ‘sample of multiplication sing Peasants" algorithm: 13 x 8: 643218 = 108 1 Le Talal ae Fil in appropriate blanks in Tunetion for calculating, mukipicaton using Peasants’ Algorithm, void peasaniMultiplication(int sum col, int sum _col2.int answer), ( int eount=0% ‘while 1) count; i Ow i. Write a statement read a file in append mode. ii, Write the purpose of the fseek{) function. (©) Is it possible to retum multiple values from a funetion? Justify the statement withthe help of an example. (c}_ Write a program that wkes string as input fiom the user and replaces each alphabet in the string ‘with next alphabet except letters "2" *2" and "a" "A". Forexample- Input string: “Programming in Zis fun" Output Sting: “Qsphsshnnjoh jo Z.jt evo” (4) Write a program to read desis of ‘n° number of employees from keyboard, The employee record should have three felds (d, name, salary). Print the details of employees whose salary is above 5000 an also store the information in ile having name recordist (e) A rectangle hue two sides parallel to the x and y axis, Define a structure ‘reclangle” to store ‘cootdinales of lower left and upper right vertioes defined by following structure “point. type! struct{ float x; float y: paint: Write 2 function: + int insidetpoinp. stuct rectangle) tha returns |i the point pis inside or on the eectangle, and 0 catherwise Q5 (a) Differentiate between the class and object. Explain withthe help of programming example. (b) Explain the visibility orhase class members for the access specifier: private, protected. and public. (©) Explain the concept of polymorphism with the help of programming example. (2) Differentiate berween the following: (). Function overloading and Operator overloading (ii) Abstraction and Encapsulation (ii) Static und Dynami binding (iv) Multiple Interitance and Mukitevel Inheritance on (©) (0) Enlist the major differences between procedures oriented and object oriented programming Tanguage. (Gi) Explain the concept of Inheritance, Demonstrate its use using programming example % 2 2 6 0 o ” 2 0 0 03 cos cos com oa co3, cod) coa Coa coa Coa cos Coa Br? Br Bra Bra an Br or Br ar art ans wa wn wnt wn wn 442
You might also like
Principles: Life and Work
From Everand
Principles: Life and Work
Ray Dalio
4/5 (643)
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
From Everand
The Gifts of Imperfection: Let Go of Who You Think You're Supposed to Be and Embrace Who You Are
Brené Brown
4/5 (1175)
The Glass Castle: A Memoir
From Everand
The Glass Castle: A Memoir
Jeannette Walls
4.5/5 (1856)
The Perks of Being a Wallflower
From Everand
The Perks of Being a Wallflower
Stephen Chbosky
4.5/5 (4103)
Sing, Unburied, Sing: A Novel
From Everand
Sing, Unburied, Sing: A Novel
Jesmyn Ward
4/5 (1267)
Her Body and Other Parties: Stories
From Everand
Her Body and Other Parties: Stories
Carmen Maria Machado
4/5 (903)
Shoe Dog: A Memoir by the Creator of Nike
From Everand
Shoe Dog: A Memoir by the Creator of Nike
Phil Knight
4.5/5 (629)
Steve Jobs
From Everand
Steve Jobs
Walter Isaacson
4.5/5 (1139)
The Emperor of All Maladies: A Biography of Cancer
From Everand
The Emperor of All Maladies: A Biography of Cancer
Siddhartha Mukherjee
4.5/5 (298)
The Yellow House: A Memoir (2019 National Book Award Winner)
From Everand
The Yellow House: A Memoir (2019 National Book Award Winner)
Sarah M. Broom
4/5 (100)
Angela's Ashes: A Memoir
From Everand
Angela's Ashes: A Memoir
Frank McCourt
4.5/5 (943)
The World Is Flat 3.0: A Brief History of the Twenty-first Century
From Everand
The World Is Flat 3.0: A Brief History of the Twenty-first Century
Thomas L. Friedman
3.5/5 (2289)
The Outsider: A Novel
From Everand
The Outsider: A Novel
Stephen King
4/5 (2885)
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
From Everand
A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story
Dave Eggers
3.5/5 (233)
Team of Rivals: The Political Genius of Abraham Lincoln
From Everand
Team of Rivals: The Political Genius of Abraham Lincoln
Doris Kearns Goodwin
4.5/5 (244)
Rise of ISIS: A Threat We Can't Ignore
From Everand
Rise of ISIS: A Threat We Can't Ignore
Jay Sekulow
3.5/5 (144)
Manhattan Beach: A Novel
From Everand
Manhattan Beach: A Novel
Jennifer Egan
3.5/5 (919)
Fear: Trump in the White House
From Everand
Fear: Trump in the White House
Bob Woodward
3.5/5 (836)
John Adams
From Everand
John Adams
David McCullough
4.5/5 (2546)
The Unwinding: An Inner History of the New America
From Everand
The Unwinding: An Inner History of the New America
George Packer
4/5 (45)
The Light Between Oceans: A Novel
From Everand
The Light Between Oceans: A Novel
M.L. Stedman
4.5/5 (815)
Little Women
From Everand
Little Women
Louisa May Alcott
4.5/5 (2369)