Solved BS-CS 7th Semester Exam Questions | GCUF
📘 Solved BS-CS 7th Semester Exam Questions
Fall 2023–2024
Govt. College University, Faisalabad
Program: BS Computer Science (7th Semester)
📱 Mobile Application Development (CSI-601)
Q1: Layered Architecture of Android OS
Android follows a layered architecture, where each layer provides services to the layer above it:
- Linux Kernel: Manages hardware drivers, memory, processes, and security.
- Native Libraries: C/C++ libraries such as SQLite, OpenGL, and Media Framework.
- Android Runtime (ART): Executes applications using Ahead-of-Time compilation.
- Application Framework: Provides APIs like Activity Manager and Content Providers.
- Applications: User-installed and built-in apps.
Q2: What is an Activity? Explain Activity Life Cycle
An Activity represents a single screen with a user interface.
The life cycle includes stages such as onCreate(), onStart(), onResume(), onPause(), onStop(), and onDestroy().
Q3: What is Event Handling in Android?
Event handling is the process by which Android responds to user actions such as clicks and touches.
- User performs an action
- Event object is generated
- Listener captures the event
- Callback method executes
Q4: Program to Find Power of a Number (Java)
import java.util.Scanner;
public class Power {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter base: ");
int base = sc.nextInt();
System.out.print("Enter exponent: ");
int exp = sc.nextInt();
int result = 1;
for(int i = 1; i <= exp; i++) {
result *= base;
}
System.out.println("Result: " + result);
}
}
Q5: What is an Intent?
An Intent is a messaging object used to request an action from another component.
- Explicit Intent: Used to start a specific activity.
- Implicit Intent: Used when the system chooses the component based on action.
⚙️ Parallel & Distributed Computing (CSI-605)
Q2: Shared Memory Multiprocessor System
In this system, multiple processors share a common memory and communicate through shared variables.
Q3: Advantages & Disadvantages of Parallel Computers
- Advantages: High performance, fast execution, and efficient resource utilization.
- Disadvantages: Complex programming, high cost, and synchronization overhead.
Q4-Q5: Message-Passing Multi-computer Systems
Each processor has its own memory and communicates using send and receive messages.
Q6: Distributed Shared Memory (DSM)
DSM provides the illusion of shared memory in distributed systems.
🧠Compiler Construction (CSI-501)
Q2 & Q4: Parsing Tables
The exam requires constructing CLR and LL(1) parsing tables for specific context-free grammars.
Q3: Phases of a Compiler
The compiler process is divided into several logical phases:
- Lexical Analysis
- Syntax Analysis
- Semantic Analysis
- Intermediate Code Generation
- Code Optimization
- Code Generation
Q5: Ambiguous vs Unambiguous Grammar
- Ambiguous Grammar: A grammar that produces more than one parse tree for the same string.
- Unambiguous Grammar: A grammar that produces exactly one parse tree for each string.
End of Blog Post
0 Comments