Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Monday, 12 May 2014

Difference Between Blackbox and Whitebox Testing

Parameter
Black Box Testing
White Box Testing
Definition
It is a Software Testing Technique that examines the functionality of an Application without peering into its working or coding.
It is a Software Testing Technique to test internal structure and working of an Application Software.
Technique Applied in
This Technique Applied in Unit, Integration, System and Acceptance levels of Software Testing Process.
This Technique Applied in Unit, Integration and system levels of Software Testing Process.
Test Procedures
For Black box Testing Specific knowledge of the application's coding/internal structure and programming in general is not required.
For White box Testing Specific knowledge of the application's coding/internal structure and programming is required.

Wednesday, 17 July 2013

User Defined Data Types in C++


The third type of data type in C++ is user defined. Following are some user defined data types:
Structure:  Collection of data elements grouped under one name is called Structure. Different data elements are called members and can have different data type of different length.
Declaration
Struct Student
{
Int roll_no;
Float marks;
} BA, BSC, BCOM;
In this example Student is declared as Structure with members roll_no and marks. BA, BSC, BCOM are the objects of structure Student. Here roll_no is declared as integer and marks as float, which are fundamental data types.

Class: Extended version of Structure is called Class. Structure holds only data whereas class can hold both data and functions. Another concept of access specifier is also added to it which uses three keywords Public, Private, Protected. Access Specifier modifies access rights as:
Public: Public members can be accessed anywhere where object is visible.
Private:Private members can be accessed only by other members of same class or by their friend functions.
Protected:Protected members can be accessed by other members or same class, their friend functions and by elements of derived classes of same class.
Declaration
Class addition
{
Int a, b;
Public:
void values(Int, Int);
}A;
Here addition is a class with one object A. Here a and b are private members of class whereas function values is a public function.

Tuesday, 9 July 2013

Derived Data Type in C++

The Data type that is derived from fundamental data types is called derived data type. Some of them are explained below:

 Array:  An array is a collection of homogeneous type of data. It is a named list of finite numbers of data elements. In array each data element is referenced by a set of consecutive numbers i.e. 1, 2, 3……n. If TECH is an array of five elements than its elements will be referenced as: TECH [1], TECH [2], TECH [3], TECH [4], TECH[5]. An Array can either be one dimensional, two dimensional or multidimensional.

Functions: Self contained block of program that performs a coherent task of some type is called Function. These are used because of following reasons:
1)It avoids writing of same code again and again because same function can be called in the main program again and again.
2)It makes programming simple because each module is written with specialized functions that makes debugging and testing easier.

Thursday, 4 July 2013

Fundamental Data Types in C++

These are those data types that are not composed of any other data types. C++ makes use of following five fundamental data types
1) Char
: This data type is used to store basic character sets. It is sometimes referred to as integer type because letters and symbols are represented in memory by the associated number codes. Table given below illustrates various types of character types along with their range.

Character Type
Size in Bytes
Minimal Range
Char
1
-128 to 127
Unsigned Char
1
0 to 255
Signed Char
1
-128 to 127

Wednesday, 19 June 2013

Selection Sort

It is the sorting technique with O (n2) Complexity. Hence this technique can’t be used for sorting large lists. This sorting technique finds maximum Value from the list and swaps it with first element. This process is repeated for the remaining list until list is not sorted.

Only n swaps are required to swap n number of elements.

Example: Consider the following unordered list   

10
40
7
3
25
33
                                                               

First Pass: Highest element in the list is 40 swap it with first element

40
10
7
3
25
33

Bubble Sort

It is the simplest type of sorting technique. In this sorting technique, first two elements are compared and if first element is greater than second, they are swapped. This process is repeated for each pair of adjacent elements to the end of the data set. It again starts with first two elements and repeat the process until no swap occurs.
This sorting technique can only be used for sorting small lists. This technique can also be used for the large lists if only few elements require sorting.

Important: Average and worst case performance of this sorting technique is O (n2).


Example: Consider the following unordered list 


5              10           3              1              9              0

Wednesday, 22 May 2013

Subroutines

It is a set of program instructions that are designed to perform a specific task and are written separately and stored in memory.Subroutines can be defined within programs, or separately in libraries that can be used by multiple programs.
It is totally different from functions in the manner that function takes parameters, perform works and does not alter any value or work with any value outside it's scope .Functions also returns some value ,although their are some function in C that do not return any value like Void() . Subroutine directly work with the values of the caller/the code segment which invoked it, and does not return values.

Explanation: Consider the example of a program in which you have to perform multiplication repeatedly and you have to write the same code again and again.to avoid so you can use a Subroutine that can be called repeatedly.Subroutines are called by CALL function.The last Instruction of every subroutine is RET to return to main program.Program may have more than one subroutines.
When Program execution is jumped from main program to subroutine, the contents of Program Counter (PC) are saved to stack .The main motive of doing so is that program execution can return to proper point of main program.

Monday, 13 May 2013

Difference between POP and OOP

Characteristics
POP
OOP
Acronym for
Procedure Oriented Programming
Object Oriented Programming
Program Division
Program is divided into small parts that are called functions.
Program is divided into small parts that are called objects.
Importance
Importance is given to functions and sequence of actions rather than data.
Importance is given to Data rather than procedures or objects.
Approach Type
It is a top down approach.
It is bottom up approach.
Access Specifier
It does not have access specifiers.
It has access specifiers named as: Public, Private and Protected.

Common Errors in Programming Languages

Following are the Most Common Errors in Programming Languages:

1) Syntax Errors: These are those types of errors that arise when a statement is not written as per the defined rules. This is the violation of rules. These types of errors are generated by the compiler. This may include:
a) Improper Termination of Statement.
b) Undeclared Variable use.
c) Missing Quotes
d) Missing Braces.


2) Logical Errors: These type of errors results in wrong output. These are generated due to wrong understanding of problem. For example: You want to calculate A+B but you have applied the logic A-B. No Doubt you will get the answer and program will execute but the result will be A-B in spite of A+B.

Thursday, 18 April 2013

Difference Between Testing and Debugging



S. No.
Testing
Debugging
1
It is a Process in which a Program is validated.
It is the Process in which program errors are removed.
2
It is a Positive activity that demonstrates that Program is correct and meets its design specifications.
It is a negative activity in which known errors or bugs are removed.
3
Testing finishes when all verifications against desired specifications have been done.
Debugging Finishes when all known errors are removed.

Thursday, 11 April 2013

Difference Between Structure and Union



Characteristics
Structure
Union
Definition
A structure is a collection of variables under a single name. These variables can be of different types, and each has a name which is used to select it from the structure.
A union is a special data type that enables to store different data types in the same memory location. You can define a union with many members, but only one member can contain a value at any given time
Declaration
typedef struct {
          char name[64];
          char course[128];
          int age;
          int year;
  } student;
union Data
{
   int i;
   float f;
   char  str[20];
} data;  
Memory Allocation
In a structure, all of its data members are stored in contiguous memory locations. The size of an object of a struct is, therefore, the size of the sum of all its data members.

Example for Structure:

struct tech
{
char p;
int x;
float Q;
int y;
}D;

memory allocated for D will be  1+2+4+2= 9 bytes

A union is a class all of whose data members are mapped to the same address within its object. The size of an object of a union is, therefore, the size of its largest data member.

Example for union :

Thursday, 4 April 2013

Difference Between malloc and alloc Functions



Characteristics
malloc( )
calloc( )
Arguments
malloc() takes only single argument which is amount of memory to allocate in bytes.
calloc() needs two arguments  i.e. No. of variables to allocate in memory, and the size of single variable in bytes.
Memory Initialization
malloc() does not initialize the allocated memory .
calloc() initializes the allocated memory to zero

Difference Between Static and Dynamic Memory Allocation



Characteristics
Static Memory Allocation
Dynamic Memory Allocation
Definition
It is Memory Allocation Technique in which Memory is allocated at compile-time before the associated program is executed.
It is the memory allocation Technique in Which memory is allocated as required at run-time.
lifetime of allocated memory
Static-duration variables are allocated in main memory, along with the executable code of the program, and persist for the lifetime of the program whether it is needed or not.
In Dynamic Memory Allocation allocated from the large pool of memory, which is called heap. In C, the library function malloc is used to

Saturday, 30 March 2013

Difference Between Application Software and System Software

Sr. No.
Application Software
System Software
1
Application Software are those Software which are designed to help the user to perform specific tasks.
System Software is Computer Software which manages and controls computer hardware so that application software can perform tasks.
2
Application Software is installed according to the requirements of the user.
System Software is gets installed when the operating system is installed on the computer.
3
Application Software includes Media Players, Word Processors and
Spread Sheet Programs.
System Software Includes programs such as compilers, debuggers, drivers, assemblers.

Difference Between C and C++

Sr. No.
C Language
C++ Language
1
C is a procedural programming Language.
C++ is a multi-paradigm
language which means it is procedural as well as object
oriented language.
2
In C, importance is given to the steps or procedure of the program.
C++ focuses on the data rather than the process.
3
Data is not secure because oops feature such as data hiding etc. are not present in C.
Data is secure because it supports oops concepts.
4
C is a low-level Language.
It is Middle level Language.
5
C uses the top-down approach .Program is formulated step by step,
each step is processed into detail.
C++ uses the bottom-up approach. In C++ base elements are first formulated which then are linked together to give rise to larger systems.

Difference Between Compiler and Interpreter

Sr. No.
Compiler
Interpreter
1
Compiler is used to translate high level instruction into machine language.
Interpreter is used to translate the high level instruction into an
intermediate code.
2
The compiler executes the entire program at a time.
The interpreter executes each and every line of program individually.
3
Compiler reports errors at the end of program compilation.
An interpreter reports error at the end of each line compilation and does not move to next line until this error is not removed.