Posts

Showing posts from 2017

C++ Interview Questions

Q1. What is the full form of OOPS? OOPS stands for Object Oriented Programming System. Q2.  What is a class? A class is a data structure where entities, attributes and actions are clubbed under one name. Class is also considered as a carbon copy which reflects the entities, attributes and actions. In general, a class defines user defined data types. For example, when we say student class, it will have student name, class, age etc. as well as the methods needed for accessing or manipulating with its members. #include class Student { public : char Name [ 20 ]; char Class [ 15 ]; int Age ; void displayStdName (); int getAge ( char stdName ); } Q3.  What is an object? An instance of a class is called as object. A class defines the skeleton of the data that we need to represent. Object represents the class with its own values to class members. For example, Student is a class and it will be represented as above. We can create various instance of class, whic

C++ Multithreading

Image
Multithreading in C++ What is Multithreading How to create a thread Initializing thread with a function Join threads Joinable and not Joinable threads Detaching thread Initializing thread with an object Passing arguments to thread Thread ID this_thread Namespace Concurrent access to resources Mutex What is Multithreading? Multithreading is an ability of a platform (Operating System, Virtual Machine  etc.) or application to create a process that consists of multiple   threads of execution (threads).   A   thread   of execution is the smallest sequence of programming instructions that can be managed independently by a scheduler. These threads can run parallel and it can increase efficiency of programs. In Multicore and Multiprocessor systems multithreading means that different threads are executed at the same time on different cores or processors. For single core systems multithreading divides the time between the threads. The operating system in turn sends a cer