## GUJARAT TECHNOLOGICAL UNIVERSITY

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

Subject Code: DI01000131

Date: 21-01-2026

Subject Name: Computer Programming Fundamentals

Time: 10:30 AM TO 01:00 PM

Total Marks: 70

## Instructions:

1. Attempt all questions.
2. Make Suitable assumptions wherever necessary.
3. Figures to the right indicate full marks.
4. Use of simple calculators and non-programmable scientific calculators are permitted.
5. English version is authentic.

|              |            |                                                                                                                                           | Marks   |
|--------------|------------|-------------------------------------------------------------------------------------------------------------------------------------------|---------|
| Q.1          | (a)        | Define Algorithm. Write Advantages of Algorithm.                                                                                          | 03      |
| પ્રશ્ન .1      | ( અ )      | અલ્ગોરિધમ વ્યાખ્યારયત કિો .  અલ્ગોરિધમના ફાયદા લખો .                                                                                                      | ૦૩      |
|              | (b)        | Draw and Explain Symbols of flowchart.                                                                                                    | 04      |
|              | ( બ )      | ફલોચાર્ટના રિમ્બોલ દોિો અને િમજાવો .                                                                                                                    | ૦૪      |
|              | (c)        | Explain basic structure of C program.                                                                                                     | 07      |
|              | ( ક )      | C  પ્રોગ્રામન ું બેરિક સ્ટર્ ર ક્ચિ િમજાવો .                                                                                                             | ૦૭      |
|              |            | OR                                                                                                                                        |         |
|              | (c)        | List  out  operators  used  in  c.  Explain  relational  operators  with  suitable  example.                                              | 07      |
|              | ( ક )      | C માું વપિાતા ઓપિેર્િ ની યાદી બનાવો ..  યોગ્ય ઉદાહિણ િાથે િીલેશનલ ઓપિેર્િ િમજાવો .                                                                                        | ૦૭      |
|              |            |                                                                                                                                           | 03      |
| Q. 2 પ્રશ્ન .2 | (a)  ( અ ) | Explain switch statement with suitable example.  યોગ્ય ઉદાહિણ િાથે  switch  સ્ટર્ ે ર્મેન્ર્ િમજાવો .                                                      | ૦૩      |
|              | (b)        | Explain if else statement with example.                                                                                                   | 04      |
|              | ( બ )      | if-else સ્ટર્ ે ર્મેન્ર્ ઉદાહિણ િાથે િમજાવો .                                                                                                            | ૦૪      |
|              | (c)        | Write a program to find count of odd numbers between two numbers n1,  n2. Take value of n1,n2 from user.  Implement this using while loop | 07      |
|              | ( ક )      | N 1  અને N 2  બે વેલ્ય  વચ્ચેના એકી નુંબિની િુંખ્યા ગણવા માર્ેનો પ્રોગ્રામ લખો .  N 1  અને N 2  વેલ્ય  ય િિ પાિેથી લો .  આ પ્રોગ્રામ while લૂપ થી બનાવો .                              | ૦૭      |
| Q. 2         | (a)        | Write a C program to find the given no is odd or even                                                                                     | 03      |
| પ્રશ્ન . 2     | ( અ )      | એકી અને બેકી નુંબિ ચેક કિવા માર્ેનો પ્રોગ્રામ લખો .                                                                                                          | ૦૩      |
|              | (b)        | Discuss Nested If-else Statement with suitable example.                                                                                   | 04      |
|              | ( બ )      | યોગ્ય ઉદાહિણ િાથે Nested If-else સ્ટર્ ે ર્મેન્ર્ ની ચચાટ કિો .                                                                                             | ૦૪      |

|          | (c)   | Generate a following output using nested for loop statement.                                                             | 07   |
|----------|-------|--------------------------------------------------------------------------------------------------------------------------|------|
|          |       | 1                                                                                                                        |      |
|          |       | 1 2                                                                                                                      |      |
|          |       | 1 2 3                                                                                                                    |      |
|          |       | 1 2 3 4                                                                                                                  |      |
|          |       | 1 2 3 4 5                                                                                                                |      |
|          | ( ક ) | નેસ્ટતેડ લૂપ સ્ટર્ ે ર્મેન્ર્ નો ઉપયોગ કિીને નીચેના આઉર્પ ર્ જનિેર્ કિો .                                                                          | ૦૭   |
|          |       | 1                                                                                                                        |      |
|          |       | 1 2 3                                                                                                                    |      |
|          |       | 1 2 3 4                                                                                                                  |      |
|          |       | 1 2 3 4 5                                                                                                                |      |
| Q. 3     | (a)   | Explain while loop with example.                                                                                         | 03   |
| પ્રશ્ન .3  | ( અ ) | While loop  યોગ્ય ઉદાહિણ િાથે િમજાવો .                                                                                             | ૦૩   |
|          | (b)   | Define array. List and Explain characteristics of an array                                                               | 04   |
|          | ( બ ) | Array  ની વ્યાખ્યા આપો .  Array ની યાદી બનાવી તેન ું વણટન કિો .                                                                          | ૦૪   |
|          | (c)   | Write  a  C  program  to  swap  the  values  of  two  integer  variables  using  pointer.                                | 07   |
|          | ( ક ) | બે ઇન્ર્ીજિ વેિીએબલને અદલ બદલ કિવા માર્ેનો C પ્રોગ્રામ પોઈન્ર્િ નો ઉપયોગ કિીને લખો .                                                                  | ૦૭   |
|          |       | OR                                                                                                                       |      |
| Q. 3     | (a)   | Give the difference between break and continue.                                                                          | 03   |
| પ્રશ્ન .3  | ( અ ) | break  અને  continue  સ્ટર્ ે ર્મેન્ર્ વચ્ચેનો તફાવત આપો .                                                                            | ૦૩   |
|          | (b)   | Define  pointer.  How  to  declare  and  initialize  pointer with  suitable  example.                                    | 04   |
|          | ( બ ) | Pointer ની વ્યાખ્યા આપો .  યોગ્ય ઉદાહિણ િાથે Pointer કેવી િીતે declare અને initialize કિવ ું તે િમજાવો .                                           | ૦૪   |
|          | (c)   | Write a C program to find the sum of all the numbers entered in array.  (Note: take single dimensional array of size 10) | 07   |
|          | ( ક ) | એિેમાું દાખલ કિેલ તમામ િુંખ્યાનો િિવાળો કિવા માર્ેનો C પ્રોગ્રામ લખો .( નોુંધ : -  10  ના માપનો એક પારિમારણક એિે લેવ ું .)                                           | ૦૭   |
| Q. 4     | (a)   | Explain void pointer with suitable example.                                                                              | 03   |
| પ્રશ્ન . 4 | ( અ ) | void pointer યોગ્ય ઉદાહિણ િાથે િમજાવો .                                                                                            | ૦૩   |
|          | (b)   | Difference between call by value and call by reference.                                                                  | 04   |
|          | ( બ ) | call by value and call by reference  વચ્ચેનો તફાવત લખો .                                                                      | ૦૪   |
|          | (c)   | Write a program to find out factorial number using recursion.                                                            | 07   |
|          | ( ક ) | િીકિટનનો ઉપયોગ કિી ફે કર્ોિીયલ નુંબિ શોધવા માર્ેનો પ્રોગ્રામ લખો .                                                                                 | ૦૭   |
|          |       | OR                                                                                                                       |      |
| Q. 4     | (a)   | Explain Advantage & disadvantage of Array.                                                                               | 03   |
| પ્રશ્ન . 4 | ( અ ) | Array ના ફાયદા અને ગેિફાયદા િમજાવો .                                                                                                | ૦૩   |
|          | (b)   | Explain  function  with  no  argument  and  no  return  type  with suitable  example                                     | 04   |
|          | ( બ ) | યોગ્ય ઉદાહિણ િાથે no argument  અને  no return type િમજાવો .                                                                         | ૦૪   |

|          | (c)   | What is recursion? Explain Advantage & disadvantage of recursion With example.         | 07   |
|----------|-------|----------------------------------------------------------------------------------------|------|
|          | ( ક ) | િીકિટન શ ું છે ? િીકિટન ના ફાયદા અને ગેિફાયદા ઉદાહિણ િાથે િમજાવો                                                | ૦૭   |
| Q.5      | (a)   | What is String? How to declare and define String?                                      | 03   |
| પ્રશ્ન . 5 | ( અ ) | સ્ટર્ ર ી ું ગ શ ું છે ? તેને declare અને વ્યાખ્યારયત કઈ િીતે કિી શકાય  ?                                   | ૦૩   |
|          | (b)   | Difference between Library function and User-defined Function.                         | 04   |
|          | ( બ ) | ય િિ રડફાઇન્ડ ફું ક્શન અને લાઈબ્રેિી ફું ક્શન વચ્ચે તફાવત આપો .                                            | ૦૪   |
|          | (c)   | Write a Program to find out Given String is Palindrome or not.                         | 07   |
|          | ( ક ) | આપેલ સ્ટર્ ર ી ું ગ પેલીન્ડર ોમ છે કે નરહ તે ચેક કિવા માર્ેનો પ્રોગ્રામ લખો .                                   | ૦૭   |
| Q.5      | (a)   | Explain Any Three String Handling Function with Example.  1) strcpy( )   2) strlen( )  | 03   |
|          |       | 3) strlwr()                                                                            |      |
|          |       | 4)strcmp()                                                                             |      |
| પ્રશ્ન . 5 | ( અ ) | કોઈ પણ ત્રણ ફું ક્શન ઉદાહિણ િાથે િમજાવો .                                                           | ૦૩   |
|          |       | 1) strcpy( )   2) strlen( )                                                            |      |
|          |       | 3) strlwr()                                                                            |      |
|          |       | 4)strcmp()                                                                             |      |
|          | (b)   | Declaring,  Defining  and  calling  user  defined  Functions  with  suitable  example. | 04   |
|          | ( બ ) | યોગ્ય ઉદાહિણ િાથે user defined Functions ને વ્યાખ્યારયત અને declare કિો .                             | ૦૪   |
|          | (c)   | Write a C Program to read data from File (using fscanf()).                             | 07   |
|          | ( ક ) | fscanf() નો ઉપયોગ કિી ફાઈલ માુંથી ડેર્ા વાુંચવા માર્ેનો C પ્રોગ્રામ લખો .                                       | ૦૭   |

***********