- Member for about 2 months
- Basic Member
This is concept of Pass by Reference. As we have seen through previous questions/answers, pointer is a variable whose value is an address of another variable. What is a linked list? How many different types of linked list are there? A Linked List is a data structure consisting of a group of nodes which together represent a sequence. Of what order is the Worst case Time complexity of following algorithms? How long does a particular algorithm run?. It is amount of time taken by an algorithm to run as a function of input string length. It makes a lot of sense to be able to estimate run time before starting an algorithm/program to see if we are efficiently using all the resources. If a program/algorithm takes lot of time to execute, we would be consuming a lot more machine resources, which is costly. Time complexity of an algorithm is expressed using Big O notation. In Big O notation we exclude coefficients and lower order terms. Best Case, Average Case and Worst Case. We are often not interested in the best case time complexity. We usually tend to compute average case or worst case time complexity. Of what order is the Space complexity of following algorithms? It is also represented in Big O notation. Explain the difference between & and && operators in C/C++? Bitwise operators perform bit operation on each of the bit and return a bit value. If a=10 and b=6, then the following expression will return true as it operates on two boolean values which are true in this example. How does a Structure and a Union differ in terms of memory allocation in C/C++? Structs allocate enough space to store all of the fields/members in the struct. The first one is stored at the beginning of the struct, the second is stored after that, and so on. Unions only allocate enough space to store the largest field listed, and all fields are stored at the same space. This is because in a union, at a time only one type of enclosed variable can be used unlike struct where all the enclosed variables can be referenced. Stack is a data structure. Kernel, Shell, and the Program. Shell is an interface between the user and the kernel. Linux is developed by open source development. What does Perl stand for? Practical Extraction and Reporting Language. Perl is an interpreted language? What does this mean? Perl continue source code translation till it meets first error and stops further processing. What are different types of data types in Perl? Preceded by $, scalars are simple variables. A scalar can be a number, or a string or a reference. Preceded by @, arrays are ordered lists of scalars. Preceded by %, hashes are unordered sets of keys/value pairs that can be accessed using keys as subscripts. When to use a Cron Job? A Cron Job is a time based job scheduling in an operating system. One of the most common use of rsync command is to perform data backup and mirror disks between two machines. Variable names in C can contain alphanumeric characters as well as special characters? False What i s the use of a ‘\0’ character in C/C++? It is terminating null character and is used to show the end of a string. What are binary trees? Binary trees are an extension of the concept of linked lists. Each side can further branch to form additional nodes which each node having two pointers as well. In general terms, concept of random number generation is important for testing a particular program/code for wide range of inputs to see if the code is working properly for various different inputs . What are Special Characters, Quantifiers, and Anchors w.r.t regular expressions? Anchors allow a user to specify position for text/pattern search. ^, $, > 3.2 Object Oriented Programming Concepts What is the difference between a class and object? A class is a set of attributes and associated behaviour that can be grouped together. An object is an instance of the class which then represents a real entity with attributes and behaviour . The attributes can be represented using class data members while the behavior can be represented using methods. What is the difference between a Class and a Struct in C++? However, in C++ this grouping was extended to include functions as well. A class is also a data type that can group different data types and functions operating on a defined functionality. The only real difference in C++ is that all members of a class are private by default, whereas all members of a struct are public by default. What is the difference between a Class and a Struct in SystemVerilog? In SystemVerilog, both class and struct are used to define a bundle of data types based on some functionality to be performed. However, a struct is an integral type and when it is declared, the necessary memory is allocated. On the other hand, a class is a dynamic type and once you declare a class, you only have a class handle referenced to null. Memory allocation happens only when an actual object of the class is created. What are public, private and protected members? These are different access attributes for class members. However unlike private members, these are also visible in derived class. What is Polymorphism? Polymorphism means the ability to assume several forms. Depending on the type of object, appropriate method will be called from the corresponding class. What are Method Overriding and Method Overloading? What is the difference between the two? Method overloading is the ability of the functions with same names to be defined multiple times with different set of parameters. Based on the type and number of arguments passed when the function is called, the correct definition will be picked up. Method overriding is supported in most of the object oriented programming languages. However, unlike C++, method overloading is not supported in SystemVerilog language. SystemVerilog language only supports method overriding in terms of virtual methods and derived classes. This is supported in C++ while not supported in SystemVerilog. Following examples shows a Testclass where the operator + is overloaded such that two class objects of type Testclass can be added. The implementation then adds the data members from two objects and assigns it to the data member of result class. } What is a constructor method? Constructor is a special member function of a class, which is invoked automatically whenever an instance of the class is created. In C++, it has the same name as its class. Destructor is a special member function of a class, which is invoked automatically whenever an object goes out of the scope. In C++, it has the same name as its class with a tilde character prefixed while in SystemVerilog, there is no destructor as the language supports automatic garbage collection. What is the difference between a shallow copy and a deep copy used in object oriented programming? In a Shallow copy, a new object is created that has an exact copy of the values as in the original object. In a Deep copy, a new object is created that has exact copies of the values as in the original object. If any object has references to other objects, a copy of all values that are part of it are also copied and not just the memory address or handle. To create a virtual function, the function declaration in the base class is preceded by the keyword virtual. What is meant by multiple inheritance? It is distinct from single inheritance, where an object or class may only inherit from one particular object or class. C++ supports multiple inheritance while SystemVerilog language doesn’t. What is an abstract class? Abstract classes are classes that contain one or more abstract methods. An abstract method is a method that is declared, but contains no implementation. Abstract classes may not be instantiated, and require subclasses to provide implementations for the abstract methods. In SystemVerilog, the class name is prepended with a virtual keyword to make it an abstract class. Following is an example of how an abstract class is defined with function defined as virtual. The derived classes can then actually implement this function. Static methods are methods defined inside a class using static keyword. These can be used without creating an object of the class. Also if there are multiple objects created of this class, there will still be only one static method which will be part of all objects.
loz23 has no publicly viewable Youtube videos.