Skip to main content
Unlisted page
This page is unlisted. Search engines will not index it, and only users having a direct link can access it.

VNSGU BCA Sem 2: Programming Skills Using C (204) Practical Solutions - April 2025 Set C

Paper Details
  • Subject: Programming Skills Using C
  • Subject Code: 204
  • Set: C
  • Semester: 2
  • Month/Year: April 2025
  • Max Marks: 25
  • Time Recommendation: 45 Minutes
  • Paper: View Paper | Download PDF

Questions & Solutions

All questions are compulsory

Q1: App Data Structure

Max Marks: 10

Create structure App Data with following members: App Name, download Count, rating, developer. Accept 5 Application details from user and print details of application whose rating is highest.

1. Structure Definition & Input

Define the App structure and read 5 records.

Hint

Use struct AppData to group related variables. Use a loop to accept input for an array of 5 structures.

View Solution & Output
#include <stdio.h>

struct AppData {
char appName[50];
long downloadCount;
float rating;
char developer[50];
};

int main() {
struct AppData apps[5];
int i, maxIndex = 0;

// [1] Input data
for(i = 0; i < 5; i++) {
printf("\nEnter details for App %d:\n", i + 1);
printf("Name: ");
scanf("%s", apps[i].appName);
printf("Downloads: ");
scanf("%ld", &apps[i].downloadCount);
printf("Rating: ");
scanf("%f", &apps[i].rating);
printf("Developer: ");
scanf("%s", apps[i].developer);

// [2] Track highest rating
if(apps[i].rating > apps[maxIndex].rating) {
maxIndex = i;
}
}

// [3] Display result
printf("\n--- App with Highest Rating ---\n");
printf("Name: %s\n", apps[maxIndex].appName);
printf("Downloads: %ld\n", apps[maxIndex].downloadCount);
printf("Rating: %.1f\n", apps[maxIndex].rating);
printf("Developer: %s\n", apps[maxIndex].developer);

return 0;
}

Step-by-Step Explanation:

  1. Initialization: Define a struct AppData and declare an array of 5 structures to store app details.
  2. Logic Flow: Loop 5 times to accept data and simultaneously compare the rating to find the index of the highest-rated app.
  3. Completion: Print the full details of the application that has the maximum rating among the five entries.

Q2: Python List Operations

Max Marks: 10

Write a Python program to create a list of student's names and perform following operations on it.

  1. Append Name in a list.
  2. Display list in sorted order.
  3. Count total number of students in list.
  4. Display last 3 names of a list.

1. List Transformation & Slicing

Manage a collection of names using standard list methods and slicing.

Hint

Use list.append(), list.sort(), len(list), and negative slicing list[-3:].

View Solution & Output
# [1] Initial List
students = ['Rahul', 'Priya', 'Amit', 'Sia']

# [i] Append Name
students.append('Aryan')
print("List after append:", students)

# [ii] Display sorted
students.sort()
print("Sorted list:", students)

# [iii] Count total
print("Total students:", len(students))

# [iv] Display last 3
print("Last 3 students:", students[-3:])

Step-by-Step Explanation:

  1. Initialization: Create a list of names and use append() to add a new student to the collection.
  2. Logic Flow: Sort the list alphabetically, calculate its length, and use negative slicing [-3:] to extract the last three items.
  3. Completion: Print the results of each operation to verify list manipulation and slicing.

Q3: Viva Preparation

Max Marks: 5

Potential Viva Questions
  1. Q: What is a Structure in C?
    • A: A user-defined data type that allows grouping variables of different data types under a single name.
  2. Q: How does list[-3:] work in Python?
    • A: It is called negative slicing; it starts from the 3rd element from the end and goes until the last element.
  3. Q: Can we sort a list containing both numbers and strings?
    • A: No, Python 3 will raise a TypeError because it cannot compare different types.
  4. Q: What is the size of a structure in C?
    • A: It is at least the sum of the sizes of its members, but often larger due to memory alignment (padding).
  5. Q: Difference between list.sort() and sorted(list)?
    • A: list.sort() modifies the original list in place and returns None. sorted() returns a new sorted list leaving the original unchanged.
  6. Q: How do you find the index of a specific name in a Python list?
    • A: Use the .index() method, e.g., students.index('Amit').
Common Pitfalls
  • String Input in C: scanf("%s", ...) stops at spaces. For names with spaces, use fgets() or gets().
  • Sorting Direction: sort() sorts in ascending order by default. Use reverse=True for descending.

Quick Navigation

SetLink
Set ASolutions
Set BSolutions
Set CCurrent Page
Set DSolutions
Set ESolutions
Set FSolutions

Last Updated: April 2026

📍 Visit Us

🏫 VD Computer Tuition Surat

VD Computer Tuition
📍 Address
2/66 Faram Street, Rustompura
Surat395002, Gujarat, India
📞 Phone / WhatsApp
+91 84604 41384
🌐 Website

Computer Classes & Tuition — Areas We Serve in Surat

AdajanAlthanAmroliAthwaAthwalinesBhagalBhatarBhestanCanal RoadChowkCitylightDumasGaurav PathGhod Dod RoadHaziraJahangirpuraKamrejKapodraKatargamLimbayatMagdallaMajura GateMota VarachhaNanpuraNew CitylightOlpadPalPandesaraParle PointPiplodPunaRanderRing RoadRustampuraSachinSalabatpuraSarthanaSosyo CircleUdhnaVarachhaVed RoadVesuVIP Road
📞 Call Sir💬 WhatsApp Sir