Showing posts with label C. Show all posts
Showing posts with label C. Show all posts

What is size of void pointer in C?

Size of any type of pointer in c is independent of data type which is pointer is pointing i.e. size of all type of pointer (near) in c is two byte either it is char pointer, double pointer, function pointer or null pointer.  Void pointer is not

What is difference between pass by value and pass by reference? in C


In c we can pass the parameters in a function in two different ways.

(a)Pass by value: In this approach we pass copy of actual variables in function as a parameter. Hence any modification on parameters inside the function will not reflect in the actual variable. For example:

Swap two variables without using third variable in C


#include<stdio.h>
int main(){
    int a=5,b=10;
//process one
    a=b+a;
    b=a-b;
    a=a-b;
    printf("a= %d  b=  %d",a,b);

//process two
    a=5;
    b=10;
    a=a+b-(b=a);
    printf("\na= %d  b=  %d",a,b);
//process three
    a=5;
    b=10;
    a=a^b;
    b=a^b;
    a=b^a;
    printf("\na= %d  b=  %d",a,b);
   
//process four
    a=5;
    b=10;
    a=b-~a-1;
    b=a+~b+1;
    a=a+~b+1;
    printf("\na= %d  b=  %d",a,b);
   
//process five
    a=5,
    b=10;
    a=b+a,b=a-b,a=a-b;
    printf("\na= %d  b=  %d",a,b);
    return 0;
}

Write a c program to print Hello world without using any semicolon.


Solution: 1
void main(){
    if(printf("Hello world")){
    }
}

SQL Server Interview Questions

1) Explain in brief about Microsoft SQL server?
Microsoft SQL server is primarily produced by Microsoft and it uses Transact-SQL as its query language. This is a Relational database management system which implements ANSI and ISO standards. It is one of the most popular software for Data base management.

Interview Questions on SQL




1.  Which is the subset of SQL commands used to manipulate Oracle Database structures, including tables?
Data Definition Language (DDL)
  1. What operator performs pattern matching?
LIKE operator

Top 10 C Programs & Answers

11.Write a program to generate the Fibonacci series.
Fibonacci series: Any number in the series is obtained by adding the previous two
numbers of the series.
Let f(n) be n'th term.
f(0)=0;
f(1)=1;
f(n)=f(n-1)+f(n-2); (for n>=2)
Series is as follows

Top 10 C programs and Answers

Write a program to find factorial of the given number.

1.

Recursion: A function is called 'recursive' if a statement within the body of a
function calls the same function. It is also called 'circular definition'. Recursion is thus a process of defining something in terms of itself.
Program: To calculate the factorial value using recursion.