0% found this document useful (0 votes)
4 views11 pages

Viva Preparation

Uploaded by

munshijubair7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views11 pages

Viva Preparation

Uploaded by

munshijubair7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Viva-Voce Preparation

CSE 151: Mathematics II CSE 150: Viva-Voce


CSE 153: Discrete Mathematics CSE 156: Data Structures Laboratory
CSE 155: Data Structures CSE 158: Electronics Devices and Circuits-I Laboratory
CSE 157: Electronics Devices and Circuits-I CSE 160: Object Oriented Programming (C++) Laboratory
CSE 159: Object Oriented Programming (C++) CSE 162: Technical Writing and Presentation Laboratory

My last Night:
I spent the evening reviewing my notes to complete my preparation, had
dinner, and made sure to get enough sleep to stay fresh for the viva.
What I Learned from the OOP Course
Book Name: Object Oriented Programming in C++
Author: Robert Lafore
Four key principles of OOP:
1. Encapsulation: Encapsulation is the bundling of data and methods into a class while
restricting direct access to some components.
2. Inheritance: Inheritance allows one class to acquire the properties and methods of
another class.
3. Polymorphism: Polymorphism enables methods or objects to behave differently based
on context.
4. Abstraction: Abstraction hides implementation details and shows only essential features
to the user

 Constructor: A special method used to initialize an object when it is created. It sets initial
values for the attributes of the object.
 Destructor: A method that is called when an object is destroyed or goes out of scope. It is
used to clean up resources, like closing files or releasing memory.

Others:
1. Class: A class is a blueprint for creating objects with attributes and methods.
2. Object: An object is an instance of a class that holds data and can perform actions.
3. Function overloading: Function overloading allows multiple functions with the same
name but different parameters to coexist in a program.
4. Function overriding: Function overriding is a concept in object-oriented programming
where a subclass provides a specific implementation of a method already defined in its
superclass, using the same method name, parameters, and return type.
5. Operator overloading: Operator overloading is a feature in object-oriented programming
that allows custom implementation of operators (e.g., +, -, *) for user-defined types,
enabling them to behave differently based on the operands.
6. Virtual Functions: A virtual function is a function in a base class that can be overridden
in a derived class to achieve runtime polymorphism.
Electronics Devices and Circuits
Book Name: Electronic Devices and Circuit Theory
FET (Field Effect Transistor)
Data Structures
1. Complexity: Time complexity refers to the amount of time an algorithm takes to run as a
function of the size of the input, while space complexity refers to the amount of memory
or storage an algorithm uses relative to the input size.
2. Time-Space Tradeoff: The time-space tradeoff refers to the concept where improving the
time complexity of an algorithm (e.g., faster execution) often requires using more
memory, and vice versa, where reducing memory usage may increase execution time.
3. Array: An array is a data structure that stores a fixed-size sequence of elements of the
same type, accessible by index, and stored in contiguous memory locations.
4. Linked List: A linked list is a linear data structure where elements (nodes) are connected
by pointers.
5. Stack: A stack is a Last-In-First-Out (LIFO) data structure that allows adding and removing
elements from one end (top).
6. A queue is a First-In-First-Out (FIFO) data structure that processes elements in the order
they were added.
7. A tree is a hierarchical structure consisting of nodes with a root and child nodes, often
used for efficient searching and sorting.
8. A graph is a collection of nodes (vertices) connected by edges, used to represent
relationships or connections between entities.
Linked list:
#include <iostream>
using namespace std;

class node {
public:
char data;
node* link;
node(char data) {
this->data = data;
link = NULL;
}
};

int main() {
node* head = new node('a');
head->link = new node('b');
head->link->link = new node('c');
cout << head->data << " -> " << head->link->data << " -> " << head->link->link->data << endl;
return 0;
}
Output: a -> b -> c
Tree:
#include <iostream>
using namespace std;

class node {
public:
int data;
node* left;
node* right;
node(int data) {
this->data = data;
left = right = NULL;
}
};

void preorder(node* root) {


if(root == NULL) return;
cout << root->data << " ";
preorder(root->left);
preorder(root->right);
}

void inorder(node* root) {


if(root == NULL) return;
inorder(root->left);
cout << root->data << " ";
inorder(root->right);
}

void postorder(node* root) {


if(root == NULL) return;
postorder(root->left);
postorder(root->right);
cout << root->data << " ";
}

int main() {
node* root = new node(1);
root->left = new node(2);
root->right = new node(3);

cout << "Pre-order: ";


preorder(root);
cout << endl;

cout << "In-order: ";


inorder(root);
cout << endl;

cout << "Post-order: ";


postorder(root);
cout << endl;
return 0;
}

Output:
Pre-order: 1 2 3
In-order: 2 1 3
Post-order: 2 3
Binary search algorithm:
#include <iostream>
using namespace std;

int BinarySearch(int arr[], int n, int target) {


int start = 0, end = n, mid;
while (start <= end) {
mid = (start + end) / 2;
if (arr[mid] == target) {
return mid;
} else if (arr[mid] > target) {
end = mid - 1;
} else {
start = mid + 1;
}
}
return -1;
}

int main() {
int n;
cout << "Enter the number of elements in the array: ";
cin >> n;

int arr[n];
cout << "Enter sorted array elements: ";
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int target;
cout << "Enter target amount: ";
cin >> target;

int result = BinarySearch(arr, n, target);

if (result == -1) {
cout << "Item not found.";
} else {
cout << "Item found at: " << result + 1;
}
return 0;
}

You might also like