Tuesday, July 27, 2010

sample cpp questions.

1.Why does main function in C,C++ have parameters? What are they used for?
int main(argc, char* argv[]).
A.argc and argv are the arguments that are passed from the command line when running a program. argc is the number, argv is an array of values.
2. What is the difference between a pointer and a reference?
A.A pointer is a variable that stores the address of another variable. It must be dereferenced before it can access the value held by the other variable. A reference is an alias for another variable. It can be used the same way that the variable can (unless the reference was declared to be const).
3. What is a stream? What kinds of streams are present in standard C++?
A.A stream is an object which you can use for input or output. It accepts other objects via the insertion << or output operators >> .
A stream can be attached to a file.
An input stream can be attached to the keyboard (such as standard input, by default).
An output stream can be attached to the program console (as standard output and standard error are, by default).
A stream can also be attached to a string.
4.What is the need for istrstream,ostrstream in C++?
A. ostrstream directly writes to the strings in memory, without sending to standard output/error.
istrstream directly reads the characters from an array in memory

5. #include


int main() {

QTextStream cout(stdout);

int i = 5;
int j=6;
int* pointer = &i;

int& reference=i;
int& reference_to_pointer=(*pointer);

i = 10;
pointer = &j;
reference_to_pointer = 7;

reference_to_pointer = 8;


cout << "i=" << i << " j=" << j << endl;

}

A. I = 8, j = 6
6.What is ‘Late-Binding’,in which type of functions this occurs?
A.Virtual functions are resolved dynamically depending on the type of object during the runtime .this is called dynamic dispatch or late-binding.which occurs only in virtual functions.
Dynamic_cast operator uses the runtime information about the type of object. this is exclusively used for RunTimeTypeIdentification.
7.What is a smart pointer to the class?
A smart pointer is an object that stores a pointer to object created on heap.
int* iptr = new int;
int* jptr = new int(10);
The standard library has std::auto_ptr as smart pointer
The boost library has s hared_ptr as smart pointer.
It behaves much like an ordinary pointer except that it automatically deletes the heap object at the right time.

Monday, July 26, 2010

MeeGo Architecture













MeeGo Architecture


MeeGo Software Architecture Overview

The MeeGo platform has been carefully created to provide the components necessary for the best device user experience. As shown in the MeeGo Reference Architecture Overview diagram below, the MeeGo architecture is divided into three layers:

* The MeeGo OS Base layer contains the Linux kernel and core services along with the Hardware Adaptation Software required to adapt MeeGo to support various hardware architectures.
* The MeeGo OS Middleware layer provides a hardware and usage model independent API for building both native applications and web run time applications.
* The MeeGo User Experience layer provides reference user experiences for multiple platform segments; the initial MeeGo release will contain reference user experiences for handhelds and netbooks and additional platform segments will be supported over time.

MeeGo OS Base
Hardware Adaptation Software

There are multiple software components that a hardware vendor must provide for MeeGo to run successfully on their platform architecture, including platform kernel drivers, core architecture additions, kernel configuration, X software additions and configuration, modem support, and hardware specific media components. You can learn more about the hardware enabling process here. These specific software components are called the hardware adaptation software and are detailed below.
Kernel

The kernel is the heart of Linux, and acts as the bridge between applications and the actual data processing done at the hardware level. There are three general categories of additions that MeeGo requires for each supported hardware platform.

* Kernel Drivers: This is the set of software drivers needed to interact with the hardware device. Some examples are drivers for wireless, camera, USB, 3G, Bluetooth, and touchscreen.
* Core Architecture Additions: These are additional packages added to the Kernel to enable certain architecture features. An example would be firmware.
* Kernel Configuration File: This file determines the options needed to get the hardware device working properly. This configuration file is in addition to the general kernel configuration file that is provided within MeeGo, and is specific to the hardware vendor platform. This file details the specific configurations required for the specific device. Examples include device architecture, processor type, device driver configuration options, network support, and kernel debugging options.

X Window System

The X Window System (also known as X11 or simply X) provides the graphical interface and the basic framework for building this interface. There are two general categories of X additions that MeeGo requires for each supported hardware platform.

* Core Architecture Additions: These are additional packages to be added to X to enable certain architecture features. Examples include the graphics controller, display, and acceleration.
* X Configuration file: This file provides configuration and runtime parameters for initializing the X windows system. If there are hardware-specific configuration options required for the X windows system, these details must be added and supplied to the specific hardware platform X configuration file. Examples include the display output and resolution.

Miscellaneous

* Bootloader: The bootloader program's only job is to perform the necessary initializations to prepare the hardware for the operating system, and it contains board- and/or processor-specific code. The bootloader provides the necessary glue between the firmware and the kernel.
* Image Device Format Tool: This provides the details on how to write an image for a specific device. It is a tool used to create a device executable in the appropriate device format.
* Modem Support: telephony framework plug-ins for specific cellular modems
* Hardware-Specific Media Codecs: Codecs that are hardware specific (such as codecs with hardware assist/offload)

MeeGo Kernel

MeeGo uses a Linux kernel from kernel.org, with architecture specific configuration and patches (as needed). Drivers are provided for each supported platform.

Qt

Qt provides application developers with the functionality to build applications with state-of-the-art graphical user interfaces. Qt is fully object-oriented, easily extensible, and allows true component programming.

Component(s): QtGui, QtCore, QtDBus, QtMultimedia, QtNetwork, QtOpenGL, QtScript, QtSql, QtSvg, QtWebKit, QtXml, Qt3Support, QtDeclarative, QtHelp, QtScriptTools, QtTest, QtXmlPattern