Tuesday, December 23, 2014


Ubuntu is one of the most popular forms of the Linux operating system. It is available for free, and will run on almost any computer. This guide will show you how to install Ubuntu by booting from a CD or within Windows itself.

Method 1 of 2: Installing From CD/DVD

  1. 1
    Download the Ubuntu ISO file. You can get the ISO file from the Ubuntu website. An ISO file is a CD image file that will need to be burned before you can use it. There are two options available from the Ubuntu website (you can also buy official Ubuntu CDs, which come in packs of 10):
    • 14.04 LTS has continuous updates and provides technical support. It is scheduled to be supported until April 2019. This option will give you the most compatibility with your existing hardware.
      Install Ubuntu Linux Step 1Bullet1.jpg
    • Ubuntu builds (not yet released) 14.10, 15.04, and 15.10 will come with limited support. They will have the newest features, though they may not work with all hardware. These releases are geared more towards experienced Linux users.
      Install Ubuntu Linux Step 1Bullet2.jpg
    • If you have a Windows 8 PC or a PC with UEFI firmware, download the 64-bit version of Ubuntu. Most older machines should download the 32-bit version.
      Install Ubuntu Linux Step 1Bullet3.jpg
    Ad
  2. Install Linux Step 1Bullet2.jpg
    2
    Burn the ISO file. Open up your burning program of choice. There are free and paid programs available that can burn an ISO to a CD or DVD.
  3. Install Linux Step 2Bullet3.jpg
    3
    Boot from the disc. Once you have finished burning the disc, restart your computer and choose to boot from the disc. You may have to change your boot preferences by hitting the Setup key while your computer is restarting. This is typically F12, F2, or Del.
  4. Install Ubuntu Linux Step 4 Version 2.jpg
    4
    Try Ubuntu before installing. Once you boot from the disc, you will be given the option to try Ubuntu without installing it. The operating system will run from the disc, and you will have a chance to explore the layout of the operating system.
    • Open the Examples folder to see how Ubuntu handles files and exploring the operating system.
      Install Ubuntu Linux Step 4Bullet1.jpg
    • Once you are done exploring, open the Install file on the desktop.
      Install Ubuntu Linux Step 4Bullet2.jpg
  5. Install Ubuntu Linux Step 5.jpg
    5
    Install Ubuntu. Your computer will need at least 4.5 GB of free space. You will want more than this if you want to install programs and create files. If you are installing on a laptop, make sure that it is connected to a power source, as installing can drain the battery faster than normal.
    • Check the “Download updates automatically” box, as well as the “Install this third-party software” box. The third-party software will allow you to play MP3 files as well as watch Flash video (such as YouTube).
      Install Ubuntu Linux Step 5Bullet1.jpg
  6. Install Ubuntu Linux Step 6.jpg
    6
    Set up the wireless connection. If your computer is not connected to the internet via Ethernet, you can configure your wireless connection in the next step.
    • If you didn’t have an internet connection in the previous step, hit the Back button after setting up the wireless connection so that you can enable automatic updates.
  7. 7
    Choose what to do with your existing operating system. If you have Windows installed on your system, you will be given a couple options on how you’d like to install Ubuntu. You can either install it alongside your previous Windows installation, or you can replace your Windows installation with Ubuntu.
    • If you install it alongside your old version of Windows, you will be given the option to choose your operating system each time you reboot your computer. Your Windows files and programs will remain untouched.
      Install Ubuntu Linux Step 7Bullet1.jpg
    • If you replace your installation of Windows with Ubuntu all of your Windows files, documents, and programs will be deleted.
      Install Ubuntu Linux Step 7Bullet2.jpg
  8. Install Ubuntu Linux Step 8.jpg
    8
    Set your partition size. If you are installing Ubuntu alongside Windows, you can use the slider to adjust how much space you would like to designate for Ubuntu. Remember that Ubuntu will take up about 4.5 GB when it is installed, so be sure to leave some extra space for programs and files.
    • Once you are satisfied with your settings, click Install Now.


      Install Ubuntu Linux Step 8Bullet1.jpg
  9. Install Ubuntu Linux Step 9.jpg
    9
    Choose your location. If you are connected to the internet, this should be done automatically. Verify that the timezone displayed is correct, and then click the Continue button.
  10. Install Ubuntu Linux Step 10 Version 2.jpg
    10
    Set your keyboard layout. You can choose from a list of options, or click the Detect Keyboard Layout button to have Ubuntu automatically pick the correct option.
  11. Install Ubuntu Linux Step 11 Version 2.jpg
    11
    Enter your login information. Enter your name, the name of the computer (which will be displayed on the network), choose a username, and come up with a password. You can choose to have Ubuntu automatically log you in, or require your username and password when it starts.
  12. Install Ubuntu Linux Step 12 Version 2.jpg
    12
    Wait for the installation process to complete. Once you choose your login info, the installation will begin. During setup, various tips for using Ubuntu will be displayed on the screen. Once it is finished, you will be prompted to restart the computer and Ubuntu will load.

Method 2 of 2: Using the Windows Installer

  1. Install Ubuntu Linux Step 13.jpg
    1
    Download the installer from the Ubuntu website. If your browser prompts you, select Run, Save, or Open. The Windows installer is not compatible with Windows 8. You must use the method in the previous section.
    • The Windows installer will install Ubuntu alongside Windows. Your files and programs will not be affected. When you reboot your computer, you will be able to choose which operating system you would like to load.
      Install Ubuntu Linux Step 13Bullet1.jpg
  2. Install Ubuntu Linux Step 14.jpg
    2
    Choose your username and password. Once you run the installer, you will be presented with the configuration menu. Choose your new Ubuntu username and password.
    • You can also change the size of the Ubuntu installation. A larger installation will give your Linux operating system more space to install programs and add files, but this will take away from the free space that Windows has access to.
      Install Ubuntu Linux Step 14Bullet1.jpg
    • You can choose your Desktop environment. The three most common are:
      Install Ubuntu Linux Step 14Bullet2.jpg
      • Ubuntu (the most popular) has Unity, a unique and intuitive desktop environment.
      • Kubuntu has KDE which resembles Windows
      • Xubuntu uses Xface, which is faster and good for PCs that are 2-3 years old.
      • Lubuntu uses LXDE, and can be used with very old PCs or netbooks with as little as 512MB of RAM.
  3. Install Ubuntu Linux Step 15.jpg
    3
    Click Install to start. The installer will begin downloading the files necessary to install Ubuntu on your computer. Installation will happen automatically.
    • Downloading the files can take a significant amount of time depending on your internet connection. You can use your computer while the files download in the background.
      Install Ubuntu Linux Step 15Bullet1.jpg
  4. Install Ubuntu Linux Step 16.jpg
    4
    Restart your computer. Once the installation is complete, you will be given the option to reboot now or later. When you reboot, you will see a new menu before Windows starts that allows you to choose between Windows and Ubuntu.
Note: Original Source: http://www.wikihow.com/Install-Ubuntu-Linux

IF YOU WANT TO INSTALL ON CUSTOM DRIVE THEN SKIP STEP 7 & 8 AND FOLLOW THESE STEPS:

You should install Ubuntu on a separate partition so that you won't lose any data. The most important thing is you should create a separate partition for Ubuntu manually, and you should select it while installing Ubuntu.
First create a separate partition for Ubuntu while running Windows (like a partition with more than 10 GB). Also create a small partition for the swap partition (size is equal to your RAM size).
  • You should know the partition sizes you created so that you can identify them easily while installing Ubuntu.
See the below images - I picked them by googling so they won't be same as yours (like partition sizes and number of partitions).
The second important thing is while installing Ubuntu select "Something else".
Enter image description here
It will allow you to select your manually created partition to install Ubuntu onto it.
Now select and edit the partition you created for Ubuntu. Be careful in selecting. Check twice that you selected the correct partition, not some other partition as you may lose data like before.
Enter image description here
Select the format partition, use as mount point as shown in the image. The size is up to you.
After that, select the swap partition, and edit it as shown in the image (size is your choice).
Enter image description here
After that select the "Device for boot loader installation" at the bottom and select the one with /dev/sda at the beginning.
Enter image description here
Now you can select "install now" at the right bottom.
It seems lengthy, but it's really easy once you know this installation.

Sunday, November 23, 2014

List for some common Linux commands

List for some common Linux commands:
  • A
    • adduser: Add a user to the system
    • addgroup: Add a group to the system
    • alias: Create an alias •
    • apropos: Search Help manual pages (man -k)
    • apt-get: Search for and install software packages (Debian/Ubuntu)
    • aptitude: Search for and install software packages (Debian/Ubuntu)
    • aspell: Spell Checker
    • awk: Find and Replace text, database sort/validate/index
  • B
    • basename: Strip directory and suffix from filenames
    • bash: GNU Bourne-Again SHell
    • bc: Arbitrary precision calculator language
    • bg: Send to background
    • break: Exit from a loop •
    • builtin: Run a shell builtin
    • bzip2: Compress or decompress named file(s)
  • C
    • cal: Display a calendar
    • case: Conditionally perform a command
    • cat: Display the contents of a file
    • cd: Change Directory
    • cfdisk: Partition table manipulator for Linux
    • chgrp: Change group ownership
    • chmod: Change access permissions
    • chown: Change file owner and group
    • chroot: Run a command with a different root directory
    • chkconfig: System services (runlevel)
    • cksum: Print CRC checksum and byte counts
    • clear: Clear terminal screen
    • cmp: Compare two files
    • comm: Compare two sorted files line by line
    • command: Run a command - ignoring shell functions •
    • continue: Resume the next iteration of a loop •
    • cp: Copy one or more files to another location
    • cron: Daemon to execute scheduled commands
    • crontab: Schedule a command to run at a later time
    • csplit: Split a file into context-determined pieces
    • cut: Divide a file into several parts
  • D
    • date: Display or change the date & time
    • dc: Desk Calculator
    • dd: Convert and copy a file, write disk headers, boot records
    • ddrescue: Data recovery tool
    • declare: Declare variables and give them attributes •
    • df: Display free disk space
    • diff: Display the differences between two files
    • diff3: Show differences among three files
    • dig: DNS lookup
    • dir: Briefly list directory contents
    • dircolors: Colour setup for "ls"
    • dirname: Convert a full pathname to just a path
    • dirs: Display list of remembered directories
    • dmesg: Print kernel & driver messages
    • du: Estimate file space usage
  • E
    • echo: Display message on screen •
    • egrep: Search file(s) for lines that match an extended expression
    • eject: Eject removable media
    • enable: Enable and disable builtin shell commands •
    • env: Environment variables
    • ethtool: Ethernet card settings
    • eval: Evaluate several commands/arguments
    • exec: Execute a command
    • exit: Exit the shell
    • expect: Automate arbitrary applications accessed over a terminal
    • expand: Convert tabs to spaces
    • export: Set an environment variable
    • expr: Evaluate expressions
  • F
    • false: Do nothing, unsuccessfully
    • fdformat: Low-level format a floppy disk
    • fdisk: Partition table manipulator for Linux
    • fg: Send job to foreground
    • fgrep: Search file(s) for lines that match a fixed string
    • file: Determine file type
    • find: Search for files that meet a desired criteria
    • fmt: Reformat paragraph text
    • fold: Wrap text to fit a specified width.
    • for: Expand words, and execute commands
    • format: Format disks or tapes
    • free: Display memory usage
    • fsck: File system consistency check and repair
    • ftp: File Transfer Protocol
    • function: Define Function Macros
    • fuser: Identify/kill the process that is accessing a file
  • G
    • gawk: Find and Replace text within file(s)
    • getopts: Parse positional parameters
    • grep: Search file(s) for lines that match a given pattern
    • groups: Print group names a user is in
    • gzip: Compress or decompress named file(s)
  • H
    • hash: Remember the full pathname of a name argument
    • head: Output the first part of file(s)
    • help: Display help for a built-in command •
    • history: Command History
    • hostname: Print or set system name
  • I
    • id: Print user and group id's
    • if: Conditionally perform a command
    • ifconfig: Configure a network interface
    • ifdown: Stop a network interface
    • ifup: Start a network interface up
    • import: Capture an X server screen and save the image to file
    • install: Copy files and set attributes
  • J
    • jobs: List active jobs •
    • join: Join lines on a common field
  • K
    • kill: Stop a process from running
    • killall: Kill processes by name
  • L
    • less: Display output one screen at a time
    • let: Perform arithmetic on shell variables •
    • ln: Make links between files
    • local: Create variables •
    • locate: Find files
    • logname: Print current login name
    • logout: Exit a login shell •
    • look: Display lines beginning with a given string
    • lpc: Line printer control program
    • lpr: Off line print
    • lprint: Print a file
    • lprintd: Abort a print job
    • lprintq: List the print queue
    • lprm: Remove jobs from the print queue
    • ls: List information about file(s)
    • lsof: List open files
  • M
    • make: Recompile a group of programs
    • man: Help manual
    • mkdir: Create new folder(s)
    • mkfifo: Make FIFOs (named pipes)
    • mkisofs: Create an hybrid ISO9660/JOLIET/HFS filesystem
    • mknod: Make block or character special files
    • more: Display output one screen at a time
    • mount: Mount a file system
    • mtools: Manipulate MS-DOS files
    • mtr: Network diagnostics (traceroute/ping)
    • mv: Move or rename files or directories
    • mmv: Mass Move and rename (files)
  • N
    • netstat: Networking information
    • nice: Set the priority of a command or job
    • nl: Number lines and write files
    • nohup: Run a command immune to hangups
    • notify-send: Send desktop notifications
    • nslookup: Query Internet name servers interactively
  • O
    • open: Open a file in its default application
    • op: Operator access
  • P
    • passwd: Modify a user password
    • paste: Merge lines of files
    • pathchk: Check file name portability
    • ping: Test a network connection
    • pkill: Stop processes from running
    • popd: Restore the previous value of the current directory
    • pr: Prepare files for printing
    • printcap: Printer capability database
    • printenv: Print environment variables
    • printf: Format and print data •
    • ps: Process status
    • pushd: Save and then change the current directory
    • pwd: Print Working Directory
  • Q
    • quota: Display disk usage and limits
    • quotacheck: Scan a file system for disk usage
    • quotactl: Set disk quotas
  • R
    • ram: ram disk device
    • rcp: Copy files between two machines
    • read: Read a line from standard input •
    • readarray: Read from stdin into an array variable •
    • readonly: Mark variables/functions as readonly
    • reboot: Reboot the system
    • rename: Rename files
    • renice: Alter priority of running processes
    • remsync: Synchronize remote files via email
    • return: Exit a shell function
    • rev: Reverse lines of a file
    • rm: Remove files
    • rmdir: Remove folder(s)
    • rsync: Remote file copy (Synchronize file trees)
  • S
    • screen: Multiplex terminal, run remote shells via ssh
    • scp: Secure copy (remote file copy)
    • sdiff: Merge two files interactively
    • sed: Stream Editor
    • select: Accept keyboard input
    • seq: Print numeric sequences
    • set: Manipulate shell variables and functions
    • sftp: Secure File Transfer Program
    • shift: Shift positional parameters
    • shopt: Shell Options
    • shutdown: Shutdown or restart linux
    • sleep: Delay for a specified time
    • slocate: Find files
    • sort: Sort text files
    • source: Run commands from a file
    • split: Split a file into fixed-size pieces
    • ssh: Secure Shell client (remote login program)
    • strace: Trace system calls and signals
    • su: Substitute user identity
    • sudo: Execute a command as another user
    • sum: Print a checksum for a file
    • suspend: Suspend execution of this shell •
    • symlink: Make a new name for a file
    • sync: Synchronize data on disk with memory
  • T
    • tail: Output the last part of files
    • tar: Tape Archiver
    • tee: Redirect output to multiple files
    • test: Evaluate a conditional expression
    • time: Measure Program running time
    • times: User and system times
    • touch: Change file timestamps
    • top: List processes running on the system
    • traceroute: Trace Route to Host
    • trap: Run a command when a signal is set(bourne)
    • tr: Translate, squeeze, and/or delete characters
    • true: Do nothing, successfully
    • tsort: Topological sort
    • tty: Print filename of terminal on stdin
    • type: Describe a command •
  • U
    • ulimit: Limit user resources •
    • umask: Users file creation mask
    • umount: Unmount a device
    • unalias: Remove an alias •
    • uname: Print system information
    • unexpand: Convert spaces to tabs
    • uniq: Uniquify files
    • units: Convert units from one scale to another
    • unset: Remove variable or function names
    • unshar: Unpack shell archive scripts
    • until: Execute commands (until error)
    • useradd: Create new user account
    • usermod: Modify user account
    • users: List users currently logged in
    • uuencode: Encode a binary file
    • uudecode: Decode a file created by uuencode
  • V
    • v: Verbosely list directory contents ("ls -l -b")
    • vdir: Verbosely list directory contents ("ls -l -b")
    • vi: Text Editor
    • vmstat: Report virtual memory statistics
  • W
    • watch: Execute/display a program periodically
    • wc: Print byte, word, and line counts
    • whereis: Search the user's $path, man pages and source files for a program
    • which: Search the user's $path for a program file
    • while: Execute commands
    • who: Print all usernames currently logged in
    • whoami: Print the current user id and name (`id -un')
    • Wget: Retrieve web pages or files via HTTP, HTTPS or FTP
    • write: Send a message to another user
  • X and onwaard
    • xargs: Execute utility, passing constructed argument list(s)
    • xdg-open: Open a file or URL in the user's preferred application.
    • yes: Print a string until interrupted
    • .: Run a command script in the current shell. ### allows you to remark or comment without disturbing the Terminal.

Codeigniter interview questions and answers

1- What is codeigniter? 
CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications.
2- What are the features of codeigniter?
  1. Codeigniter is free to use,its an open source framework.
  2. Model-View-Controller Based System.
  3. Extremely Light Weight.
  4. Full Featured database classes with support for several platforms..
  5. CodeIgniter is Extensible.The system can be easily extended through the use of your own libraries, helpers, or through class extensions or system hooks.
  6. Excelent documentation.
  7. Full Featured database classes with support for several platforms,Security and XSS Filtering,Error Logging.
3- Explain Codeigniter File Structure?
following are the folder structure :-
  • application
    • cache
    • Config
    • Controllers
    • core
    • errors
    • helpers
    • hooks
    • language
    • libraries
    • logs
    • models
    • thirdparty
    • views
  • system
    • core
    • database
    • fonts
    • helpers
    • language
    • libraries
4- Explain Application Flow Chart in codeigniter?
The following graphic illustrates how data flows throughout the system:
CodeIgniter application flow
  1. The index.php serves as the front controller, initializing the base resources needed to run CodeIgniter.
  2.  The Router examines the HTTP request to determine what should be done with it.
  3. If a cache file exists, it is sent directly to the browser, bypassing the normal system execution.
  4.  Security. Before the application controller is loaded, the HTTP request and any user submitted data is filtered for security.
  5. The Controller loads the model, core libraries, helpers, and any other resources needed to process the specific request.
  6. The finalized View is rendered then sent to the web browser to be seen. If caching is enabled, the view is cached first so that on subsequent requests it can be served.
5- Explain MVC in Codeigniter?
CodeIgniter is based on the Model-View-Controller development pattern. MVC is a software approach that separates application logic from presentation. In practice, it permits your web pages to contain minimal scripting since the presentation is separate from the PHP scripting.
  • The Model represents your data structures. Typically your model classes will contain functions that help you retrieve, insert, and update information in your database.
  • The View is the information that is being presented to a user.
    A View will normally be a web page, but in CodeIgniter, a view can also be a page fragment like a header or footer. It can also be an RSS page, or any other type of "page".
  • The Controller serves as an intermediary between the Model, the View, and any other resources needed to process the HTTP request and generate a web page.
6- What are the hooks in codeigniter?
CodeIgniter's Hooks feature provides a means to tap into and modify the inner workings of the framework without hacking the core files. When CodeIgniter runs it follows a specific execution process, diagramed in the Application Flow page. There may be instances, however, where you'd like to cause some action to take place at a particular stage in the execution process. For example, you might want to run a script right before your controllers get loaded, or right after, or you might want to trigger one of your own scripts in some other location.
The hooks feature can be globally enabled/disabled by setting the following item in the application/config/config.php file:
$config['enablehooks'] = TRUE;
7. How you will load an model in codeigniter?
$this->load->model('Modelname');
8- What are the helpers in codeigniter?
Helpers, as the name suggests, help you with tasks. Each helper file is simply a collection of functions in a particular category. There are URL Helpers, that assist in creating links, there are Form Helpers that help you create form elements, Text Helpers perform various text formatting routines, Cookie Helpers set and read cookies, File Helpershelp you deal with files, etc.
Unlike most other systems in CodeIgniter, Helpers are not written in an Object Oriented format. They are simple, procedural functions. Each helper function performs one specific task, with no dependence on other functions.
Loading a helper file is quite simple using the following function:
$this->load->helper('name');
9- How you will use or add codeigniter libraries?
When we use the term "Libraries" we are normally referring to the classes that are located in the libraries directory and described in the Class Reference of this user guide. In this case, however, we will instead describe how you can create your own libraries within your application/libraries directory in order to maintain separation between your local resources and the global framework resources.
10. How you will work with error handling in codeigniter?
CodeIgniter lets you build error reporting into your applications using the functions described below. In addition, it has an error logging class that permits error and debugging messages to be saved as text files.
showerror('message' [, int $statuscode= 500 ] )
This function will display the error message supplied to it using template application/errors/errorgeneral.php.
show404('page' [, 'logerror'])

This function will display the 404 error message supplied to it using template application/errors/error404.php.
logmessage('level', 'message')

This function lets you write messages to your log files. You must supply one of three "levels" in the first parameter, indicating what type of message it is (debug, error, info), with the message itself in the second parameter.

Note: This article is taken from "http://www.programmerdesk.com/blog/detail/33/Codeigniter-interview-questions-and-answers#.VHGxcouUfkU" 

OOP Interview Questions and Answers

1.       What is OOPS?
OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a collection of objects. Each object is nothing but an instance of a class.
  
2.       Write basic concepts of OOPS?
Following are the concepts of OOPS and are as follows:.
  1. Abstraction.
  2. Encapsulation.
  3. Inheritance.
  4. Polymorphism.
 3.       What is a class?
A class is simply a representation of a type of object. It is the blueprint/ plan/ template that describe the details of an object.
 
4.       What is an object?
Object is termed as an instance of a class, and it has its own state, behavior and identity.
 
5.       What is Encapsulation?
Encapsulation is an attribute of an object, and it contains all data which is hidden. That hidden data can be restricted to the members of that class.
Levels are Public,Protected, Private, Internal and Protected Internal.
 
6.       What is Polymorphism?
Polymorphism is nothing butassigning behavior or value in a subclass to something that was already declared in the main class. Simply, polymorphism takes more than one form.
 
7.       What is Inheritance?
Inheritance is a concept where one class shares the structure and behavior defined in another class. Ifinheritance applied on one class is called Single Inheritance, and if it depends on multiple classes, then it is called multiple Inheritance.
 
8.       What are manipulators?
Manipulators are the functions which can be used in conjunction with the insertion (<<) and extraction (>>) operators on an object. Examples are endl and setw.
 
9.       Define a constructor?
Constructor is a method used to initialize the state of an object, and it gets invoked at the time of object creation. Rules forconstructor are:.
  • Constructor Name should be same asclass name.
  • Constructor must have no return type.

10.   Define Destructor?
Destructor is a method which is automatically called when the object ismade ofscope or destroyed. Destructor name is also same asclass name but with the tilde symbol before the name.
 
11.   What is Inline function?
Inline function is a technique used by the compilers and instructs to insert complete body of the function wherever that function is used in the program source code.
 
12.   What is avirtual function?
Virtual function is a member function ofclass and its functionality can be overridden in its derived class. This function can be implemented by using a keyword called virtual, and it can be given during function declaration.
Virtual function can be achieved in C++, and it can be achieved in C Languageby using function pointers or pointers to function.
 
13.   What isfriend function?
Friend function is a friend of a class that is allowed to access to Public, private or protected data in that same class. If the function is defined outside the class cannot access such information.
Friend can be declared anywhere in the class declaration, and it cannot be affected by access control keywords like private, public or protected.
 
14.   What is function overloading?
Function overloading is defined as a normal function, but it has the ability to perform different tasks. It allowscreation of several methods with the same name which differ from each other by type of input and output of the function.
Example
void add(int& a, int& b);
void add(double& a, double& b);
void add(struct bob& a, struct bob& b);
 
15.   What is operator overloading?
Operator overloading is a function where different operators are applied and depends on the arguments. Operator,-,* can be used to pass through the function , and it has their own precedence to execute.
Example:
class complex {
double real, imag;
public:
complex(double r, double i) :
real(r), imag(i) {}
complex operator+(complex a, complex b);
complex operator*(complex a, complex b);
complex& operator=(complex a, complex b);
}
a=1.2, b=6
 
16.   What is an abstract class?
An abstract class is a class which cannot be instantiated. Creation of an object is not possible withabstract class , but it can be inherited. An abstract class can contain only Abstract method.
 
17.   What is a ternary operator?
Ternary operator is said to be an operator which takes three arguments. Arguments and results are of different data types , and it is depends on the function. Ternary operator is also called asconditional operator.
 
18.   What is the use of finalize method?
Finalize method helps to perform cleanup operations on the resources which are not currently used. Finalize method is protected , and it is accessible only through this class or by a derived class.
 
19.   What are different types of arguments?
A parameter is a variable used during the declaration of the function or subroutine and arguments are passed to the function , and it should match with the parameter defined. There are two types of Arguments.
  • Call by Value – Value passed will get modified only inside the function , and it returns the same value whatever it is passed it into the function.
  • Call by Reference – Value passed will get modified in both inside and outside the functions and it returns the same or different value.
 
 
20.   What is super keyword?
Super keyword is used to invoke overridden method which overrides one of its superclass methods. This keyword allows to access overridden methods and also to access hidden members of the superclass.
It also forwards a call from a constructor to a constructor in the superclass.
 
21.   What is method overriding?
Method overriding is a feature that allows sub class to provide implementation of a method that is already defined in the main class. This will overrides the implementation in the superclass by providing the same method name, same parameter and same return type.
 
22.   What is an interface?
An interface is a collection of abstract method. If the class implements an inheritance, and then thereby inherits all the abstract methods of an interface.
 
23.   What is exception handling?
Exception is an event that occurs during the execution of a program. Exceptions can be of any type – Run time exception, Error exceptions. Those exceptions are handled properly through exception handling mechanism like try, catch and throw keywords.
 
24.   What are tokens?
Token is recognized by a compiler and it cannot be broken down into component elements. Keywords, identifiers, constants, string literals and operators are examples of tokens.
Even punctuation characters are also considered as tokens – Brackets, Commas, Braces and Parentheses.
 
25.   Difference between overloading and overriding?
Overloading is static binding whereas Overriding is dynamic binding. Overloading is nothing but the same method with different arguments , and it may or may not return the same value in the same class itself.
Overriding is the same method names with same arguments and return types associates with the class and its child class.
 
26.   Difference between class and an object?
An object is an instance of a class. Objects hold any information , but classes don’t have any information. Definition of properties and functions can be done at class and can be used by the object.
Class can have sub-classes, and an object doesn’t have sub-objects.
 
27.   What is an abstraction?
Abstraction is a good feature of OOPS , and it shows only the necessary details to the client of an object. Means, it shows only necessary details for an object, not the inner details of an object. Example – When you want to switch On television, it not necessary to show all the functions of TV. Whatever is required to switch on TV will be showed by using abstract class.
 
28.   What are access modifiers?
Access modifiers determine the scope of the method or variables that can be accessed from other various objects or classes. There are 5 types of access modifiers , and they are as follows:.
  •  Private.
  • Protected.
  • Public.
  • Friend.
  • Protected Friend.
29.   What is sealed modifiers?
Sealed modifiers are the access modifiers where it cannot be inherited by the methods. Sealed modifiers can also be applied to properties, events and methods. This modifier cannot be applied to static members.
 
30.   How can we call the base method without creating an instance?
Yes, it is possible to call the base method without creating an instance. And that method should be,.
Static method.
Doing inheritance from that class.-Use Base Keyword from derived class.
 
31.   What is the difference between new and override?
The new modifier instructs the compiler to use the new implementation instead of the base class function. Whereas, Override modifier helps to override the base class function.
 
32.   What are the various types of constructors?
There are three various types of constructors , and they are as follows:.
-          Default Constructor – With no parameters.
-          Parametric Constructor – With Parameters. Create a new instance of a class and also passing arguments simultaneously.
-          Copy Constructor – Which creates a new object as a copy of an existing object.
 
33.   What is early and late binding?
Early binding refers to assignment of values to variables during design time whereas late binding refers to assignment of values to variables during run time.
 
34.   What is ‘this’ pointer?
THIS pointer refers to the current object of a class. THIS keyword is used as a pointer which differentiates between the current object with the global object. Basically, it refers to the current object.
 
35.   What is the difference betweenstructure and a class?
Structure default access type is public , but class access type is private. A structure is used for grouping data whereas class can be used for grouping data and methods. Structures are exclusively used for dataand it doesn’t require strict validation , but classes are used to encapsulates and inherit data which requires strict validation.
 
36.   What is the default access modifier in a class?
The default access modifier of a class is Private by default.
 
37.   What is pure virtual function?
A pure virtual function is a function which can be overridden in the derived classbut cannot be defined. A virtual function can be declared as Pure by using the operator =0.
Example -.
Virtual void function1() // Virtual, Not pure
Virtual void function2() = 0 //Pure virtual
 
38.   What are all the operators that cannot be overloaded?
Following are the operators that cannot be overloaded -.
  1. Scope Resolution (:: )
  2. Member Selection (.)
  3. Member selection through a pointer to function (.*)
 
39.   What is dynamic or run time polymorphism?
Dynamic or Run time polymorphism is also known as method overriding in which call to an overridden function is resolved during run time, not at the compile time. It means having two or more methods with the same name,same signature but with different implementation.
 
40.   Do we require parameter for constructors?
No, we do not require parameter for constructors.
 
41.   What is a copy constructor?
This is a special constructor for creating a new object as a copy of an existing object. There will be always only on copy constructor that can be either defined by the user or the system.
 
42.   What does the keyword virtual represented in the method definition?
It means, we can override the method.
 
43.   Whether static method can use non static members?
False.
 
44.   What arebase class, sub class and super class?
Base class is the most generalized class , and it is said to be a root class.
Sub class is a class that inherits from one or more base classes.
Super class is the parent class from which another class inherits.
 
45.   What is static and dynamic binding?
Binding is nothing but the association of a name with the class. Static binding is a binding in which name can be associated with the class during compilation time , and it is also called as early Binding.
Dynamic binding is a binding in which name can be associated with the class during execution time , and it is also called as Late Binding.
 
46.   How many instances can be created for an abstract class?
Zero instances will be created for an abstract class.
 
47.   Which keyword can be used for overloading?
Operator keyword is used for overloading.
 
48.   What is the default access specifier in a class definition?
Private access specifier is used in a class definition.
 
49.   Which OOPS concept is used as reuse mechanism?
Inheritance is the OOPS concept that can be used as reuse mechanism.
 
50.   Which OOPS concept exposes only necessary information to the calling functions?
Data Hiding / Abstraction

How to backup and download Database using PHP

< ?php $mysqlUserName = 'databaseusername' ; $mysqlPassword = 'databasepassword' ; $mysqlHostNa...