## GUJARAT TECHNOLOGICAL UNIVERSITY

Diploma Engineering - SEMESTER - 1 (NEW) - EXAMINATION - Summer-2025

Subject Code: DI01000131

Date: 12-06-2025

Subject Name: Computer Programming Fundamentals

Time: 10:30 AM TO 01:00 PM

Instructions:

1.

Attempt all questions.

2.

3.

4.

Make Suitable assumptions wherever necessary.

Figures to the right indicate full marks.

Use of simple calculators and non-programmable scientific calculators are permitted.

5.

English version is authentic.

|          |       |                                                                                      | Marks   |
|----------|-------|--------------------------------------------------------------------------------------|---------|
| Q.1      | (a)   | Draw and explain symbols used to prepare flowchart.                                  | 03      |
| પ્રશ્ન .1  | ( અ ) | ફ્લોચાર્ટ તૈયાર કરવા માર્ે વપરાતા પ્રતીકો દોરો અને સમજાવો .                                              | ૦૩      |
|          | (b)   | Write an algorithm to print odd numbers between 1 to N.                              | 04      |
|          | ( બ ) | 1  થી  N  વચ્ચેની વવષમ સંખ્યાઓ છાપવા માર્ે અલ્ગોવરધમ લખો .                                          | ૦૪      |
|          | (c)   | What is operator? and Explain Different types of Operators in C.                     | 07      |
|          | ( ક ) | ઓપરેર્ર શ ં છે ?  અને  C  માં વવવવધ પ્રકારના ઓપરેર્રો સમજાવો                                        | ૦૭      |
|          |       | OR                                                                                   |         |
|          | (c)   | Explain basic structure of C program.                                                | 07      |
|          | ( ક ) | C  પ્રોગ્રામની મૂળભૂત રચના સમજાવો                                                              | ૦૭      |
| Q.2      | (a)   | Discuss simple If Statement with suitable example.                                   | 03      |
| પ્રશ્ન .2  | ( અ ) | યોગ્ય ઉદાહરણ સાથે  simple if  વનવેદનની ચચાટ કરો .                                             | ૦૩      |
|          | (b)   | List out types of UDF with its syntax.                                               | 04      |
|          | ( બ ) | UDF  ના પ્રકારો તેની વાક્યરચના સાથે સૂવચબદ્ધ કરો                                                   | ૦૪      |
|          | (c)   | What  is  an  array?  Describe  the  types  of  array  with  the  suitable  example. | 07      |
|          | ( ક ) | એરે શ ં છે ?  યોગ્ય ઉદાહરણ સાથે એરેના પ્રકારોન ં વણટન કરો                                           | ૦૭      |
|          |       | OR                                                                                   |         |
| Q.2      | (a)   | What is the difference between a while loop and a do-while loop?                     | 03      |
| પ્રશ્ન . 2 | ( અ ) | જ્યારે લૂપ અને ડ  - વ્હાઈલ લૂપ વચ્ચે શ ં તફાવત છે ?                                               | ૦૩      |
|          | (b)   | What is recursion? Explain with an example..                                         | 04      |
|          | ( બ ) | recursion  છે ?  ઉદાહરણ સાથે સમજાવો .                                                      | ૦૪      |
|          | (c)   | Write a program to generate the following pattern using nested loops:  1             | 07      |
|          |       | 1 2                                                                                  |         |
|          |       | 1 2 3                                                                                |         |
|          | )     | 1 2 3 4                                                                              |         |
|          | ( ક   | નેસ્ર્ે ડ લૂપ્સનો ઉપયોગ કરીને નીચેની પેર્નટ જનરેર્ કરવા માર્ે એક પ્રોગ્રામ લખો :                               | ૦૭      |

Total Marks: 70

|          |       | 1                                                                                                              |    |
|----------|-------|----------------------------------------------------------------------------------------------------------------|----|
|          |       | 1 2                                                                                                            |    |
|          |       | 1 2 3                                                                                                          |    |
|          |       | 1 2 3 4                                                                                                        |    |
| Q. 3     | (a)   | Define pointers. Write a simple program to demonstrate the use of  pointers.                                   | 03 |
| પ્રશ્ન .3  | ( અ ) | પોઇન્ર્ર વ્યાખ્યાવયત કરો .  પોઇન્ર્રનો ઉપયોગ દશાટવવા માર્ે એક સરળ પ્રોગ્રામ લખો .                                                     | ૦૩ |
|          | (b)   | Write a program to calculate the sum of elements in a one-dimensional  array                                   | 04 |
|          | ( બ ) | એક - પવરમાણીય એરેમાં તત્વોના સરવાળાની ગણતરી કરવા માર્ે એક પ્રોગ્રામ લખો                                                             | ૦૪ |
|          | (c)   | Explain how to declare and initialize a two-dimensional array in C.  Write a program to add two 2x2 matrices.  | 07 |
|          | ( ક ) | C  માં વિ - પવરમાણીય એરે કેવી રીતે જાહેર કરવ ં અને પ્રારંભ કરવ ં તે સમજાવો .  બે  2x2  મેવર્ િ વસસ ઉમેરવા માર્ે પ્રોગ્રામ લખો .                   | ૦૭ |
|          |       | OR                                                                                                             |    |
| Q. 3     | (a)   | What is the difference between arrays and pointers?                                                            | 03 |
| પ્રશ્ન .3  | ( અ ) | એરે અને પોઇન્ર્ર વચ્ચે શ ં તફાવત છે ?                                                                                    | ૦૩ |
|          | (b)   | Write a program to find the maximum element in a one-dimensional  array using pointers.                        | 04 |
|          | ( બ ) | પોઇન્ર્રનો ઉપયોગ કરીને એક - પવરમાણીય એરેમાં મહત્તમ તત્વ શોધવા માર્ે પ્રોગ્રામ લખો .                                                    | ૦૪ |
|          | (c)   | List out characteristics of pointers. Explaindeclaration and  initialization of pointer with suitable example. | 07 |
|          | ( ક ) | પોઇન્ર્ર લાક્ષવણકતાઓની યાદી બનાવો .  યોગ્ય ઉદાહરણ સાથે વનદેશકની ઘોષણા અને પ્રારંભ સમજાવો .                                               | ૦૭ |
| Q. 4     | (a)   | Differentiate the break and continue statements in loops.                                                      | 03 |
| પ્રશ્ન . 4 | ( અ ) | break and continue. વચ્ચે તફાવત લખો .                                                                              | ૦૩ |
|          | (b)   | What  are  the  different  categories  of  user-defined  functions  in  C?  Explain any two with examples.     | 04 |
|          | ( બ ) | C  માં વપરાશકતાટ - વ્યાખ્યાવયત કાયોની વવવવધ શ્રેણીઓ શ ં છે ?  કોઈપણ બેને ઉદાહરણો સાથે સમજાવો .                                          | ૦૪ |
|          | (c)   | Write a program in C to pass an array to a function and calculate the  sum of all its elements.                | 07 |
|          | ( ક ) | ફં ક્શનમાં એરે પસાર કરવા માર્ે  C  માં પ્રોગ્રામ લખો અને તેના તમામ ઘર્કોના સરવાળાની ગણતરી કરો                                               | ૦૭ |
|          |       | OR                                                                                                             |    |
| Q. 4     | (a)   | Explain printf() and scanf() statement in C with suitable example.                                             | 03 |
| પ્રશ્ન . 4 | ( અ ) | C  માં  printf()  અને  scanf()  સ્ર્ે ર્મેન્ર્ને યોગ્ય ઉદાહરણ સાથે સમજાવો                                                        | ૦૩ |
|          | (b)   | What is Function? List Out types of Function.                                                                  | 04 |
|          | ( બ ) | ફં ક્શનન શ ં છે ?  ફં ક્શનના પ્રકારોની યાદી બનાવો .                                                                           | ૦૪ |
|          | (c)   | Explain the scope, visibility, and lifetime of variables in C with  examples.                                  | 07 |

|          | ( ક )   | C  માં   scope, visibility, and lifetime  ઉદાહરણો સાથે સમજાવો .                                                                   | ૦૭   |
|----------|---------|---------------------------------------------------------------------------------------------------------------------------|------|
| Q.5      | (a)     | Explain switch statement with example                                                                                     | 03   |
| પ્રશ્ન . 5 | ( અ )   | ઉદાહરણ સાથે વસ્વચ સ્ર્ે ર્મેન્ર્ સમજાવો                                                                                                | ૦૩   |
|          | (b)     | Explain the following function of file handling with syntax Open()  and Close().                                          | 04   |
|          | ( બ )   | ઓપન ()  અને ક્લોઝ ()  વાક્યરચના સાથે ફાઈલ હેન્ડવલંગના નીચેના કાયટને સમજાવો  .                                                                 | ૦૪   |
|          | (c)     | Explain fopen( ) and fclose( ) function for file handling in C. Write a  small code to demonstrate use of both functions. | 07   |
|          | ( ક )   | C  માં ફાઇલ હેન્ડવલંગ માર્ે  fopen( )  અને  fclose( )  ફં ક્શન સમજાવો .  બંને ફં ક્શનનો ઉપયોગ દશાટવવા માર્ે એક નાનો કોડ લખો                            | ૦૭   |
|          |         | OR                                                                                                                        |      |
| Q.5      | (a)     | Explain IF ELSE and Nested IF ELSE statement with example                                                                 | 03   |
| પ્રશ્ન . 5 | ( અ )   | ઉદાહરણ સાથે  IF ELSE  અને  Nested IF ELSE  સ્ર્ે ર્મેન્ર્ સમજાવો                                                                       | ૦૩   |
|          | (b)     | Write a program to demonstrate strcpy( ) , strlen( ) functions.                                                           | 04   |
|          | ( બ )   | strcpy( ) , strlen( )  ફં ક્શન્સ દશાટવવા માર્ે પ્રોગ્રામ લખો .                                                                         | ૦૪   |
|          | (c)     | Write a program in C to count the number of vowels in a given string.                                                     | 07   |
|          | ( ક )   | આપેલ સ્ર્ િ ી ં ગમાં સ્વરોની સંખ્યા ગણવા માર્ે  C  માં પ્રોગ્રામ લખો .                                                                             | ૦૭   |

*******************