-
What is statement and branch coverage for this program?
c#include
main()
{
call add();
int NO1,NO2NO3
}
void add()
{
scanf("%d",&NO1);
scanf("%d",&NO2);
NO3=sum(NO1,NO2);
printf("%d",NO3);
}
void sum(int x,int y)
{
return(x+y);
}
-
How to find angle between hands of clock between old time and new time?
input1: 02:45:56 (string)
input2: 03:06:17 (string)
output:
1) angle between the old position of hour hand and new position of hour hand
2) angle between the old position of minute hand and new position of minute hand
3) angle between the old position of second hand and new position of second hand -
Big endian or Little endian
How will you find whether your system is following Big endian or Little endian representations. Write C code. In Little endian, the lowest byte is stored in lowest address.
-
Variables Storage
Variables should be stored in local blocks. Yes or No?
-
Value of x at the Time of Execution
What is the value of x at the time of execution?
int x = 3;
if( x == 2 );
x = 0;
if( x == 3 )
x++;
else x += 2; -
Find Longest Common Substring
Write a Logic/Pseudo Code to find longest common substring from two given strings. i.e. Out of two strings, “I like New York City the most.†And “Who else like New York City as I do?â€, “like New York City†is the longest common substring.
Difference between b++ and b=b+1
What is the difference between b++ and b=b+1?
Which one is more used and why?Logical Operator and Pre-increment Operator
what is the output of the following program
int x,y,z;
x=y=z=1;
z=++x||++y &&++z;
printf("%d,%d,%d",x,y,z);
return 0;
Size of structure
struct {
int a : 8;
int b : 10;
int c : 12;
int d : 4;
int e : 3;
int : 0;
int f : 1;
char g;
} A;
what is the size of structure. size of bitfields with out character allocation is 48 bytes. so it is taking 4+4 =8 bytes. what about memory for character. Why memory for char is not allocated seperately. I am...What will be output of following program and how?
i=4;
j=++i*++i;
printf("%d", j);
My Ans-30;How would you declare an array of pointers to functions?
How would you declare an array of pointers to functions that take no parameters and return an int?
A. int (*arr[N])(void);
B. int *arr(void)[N];
C. int *arr[N](void);
D. int (*arr)(void)[N];What is the difference between goto and longjmp() and setjmp()?
A goto statement implements a local jump of program execution, and the longjmp() and setjmp() functions implement a nonlocal, or far, jump of program execution. Generally, a jump in execution of any kind should be avoided because it is not considered good programming practice to use such statements as goto and longjmp in your program. A goto statement simply bypasses code in your program and jumps...
Is it acceptable to declare/define a variable in a C header?
A global variable that must be accessed from more than one file can and should be declared in a header file. In addition, such a variable must be defined in one source file. Variables should not be defined in header files, because the header file can be included in multiple source files, which would cause multiple definitions of the variable. The ANSI C standard will allow multiple external definitions,...
What is the easiest searching method to use?
Just as qsort() was the easiest sorting method, because it is part of the standard library, bsearch() is the easiest searching method to use. If the given array is in the sorted order bsearch() is the best method. Following is the prototype for bsearch(): void *bsearch(const void *key, const void *buf, size_t num, size_t size, int (*comp)(const void *, const void*)); Another simple searching...
How can I sort a linked list?
Both the merge sort and the radix sort are good sorting algorithms to use for linked lists.
How can I search for data in a linked list?
Unfortunately, the only way to search a linked list is with a linear search, because the only way a linked list’s members can be accessed is sequentially. Sometimes it is quicker to take the data from a linked list and store it in a different data structure so that searches can be more efficient.
What is Preprocessor?
The preprocessor is used to modify your program according to the preprocessor directives in your source code. Preprocessor directives (such as #define) give the preprocessor specific instructions on how to modify your source code. The preprocessor reads in all of your include files and the source code you are compiling and creates a preprocessed version of your source code. This preprocessed version...
How many levels deep can include files be nested?
Even though there is no limit to the number of levels of nested include files you can have, your compiler might run out of stack space while trying to include an inordinately high number of files. This number varies according to your hardware configuration and possibly your compiler.
What is #line used for?
The #line preprocessor directive is used to reset the values of the _ _LINE_ _ and _ _FILE_ _ symbols, respectively. This directive is commonly used in fourth-generation languages that generate C language source files.
What is a null pointer?
There are times when it’s necessary to have a pointer that doesn’t point to anything. The macro NULL, defined in <stddef.h>, has a value that’s guaranteed to be different from any valid pointer. NULL is a literal zero, possibly cast to void* or char*. Some people, notably C++ programmers, prefer to use 0 rather than NULL. The null pointer is used in three ways: 1) To stop indirection in...
Ans