1)What
is the output of this C code?
#include
<stdio.h>
int
main()
{
char
*str = “hello, world”;
char
*str1 = “hello, world”;
if
(strcmp(str, str1))
printf(“equal”);
else
printf(“unequal”);
}
2)What
does the following declaration mean?
int
(*ptr)[10];
3)What
will be output if you will compile and execute the following c code?
void
main(){
int
i=320;
char
*ptr=(char *)&i;
printf(“%d”,*ptr);
}
4)Which function sets first n characters of a string
to a given character?
5)How
will you print \n on the screen?
6)The
library function used to find the last occurrence of a character in a string?
7)What
is the output of this C code?
#include
<stdio.h>
void
main()
{ char *s = “hello”;
char*p
= s;
printf("%p\t%p",
p, s);
}
8)What
is the output of this C code?
#include<stdio.h>
int
main()
{
char
str[]="c4learn";
printf("%d",*(str+strlen(str)));
return(0);
}
9)What
is the output of this C code?
#include<stdio.h>
void
main()
{
char
arr[5*2/2] = {'a','b','c','d','e'};
printf("%c",arr[3]);
}
10)What
is the output of this C code?
intmain()
{
intarr[5];
// Assume that base address of arr is 2000
and size of integer
// is 32 bit
arr++;
printf("%u", arr);
return0;
}
11)Output
of following program?
#
include <stdio.h>
voidfun(int*ptr)
{
*ptr = 30;
}
intmain()
{
inty = 20;
fun(&y);
printf("%d", y);
return0;
}
12)What
is the output of following program?
#include<stdio.h>
voidswap(char*str1,
char*str2)
{
char*temp = str1;
str1 = str2;
str2 = temp;
}
intmain()
{
char*str1 = "Geeks";
char*str2 = "Quiz";
swap(str1, str2);
printf("str1 is %s, str2 is %s",
str1, str2);
return0;
}
13)What
is the return type of malloc() or calloc()?
14)Output
of following program?
intmain()
{
inta[] = {1, 2, 3, 4, 5, 6};
int*ptr = (int*)(&a+1);
printf("%d ", *(ptr-1) );
return0;
}
15)Predict
the output?
intmain()
{
char*ptr = "GeeksQuiz";
printf("%c\n", *&*&*ptr);
return0;
}
16)
syntax for the function strpbrk();?
17)syntax
for the function memset();?
18)write
the syntax of the function exit();?
19)what
function is used to find the absolute value of an integer?write the syntax.
20)is
there any standard library function to perform binary search,if it is write the
syntax and write where it is?
No comments:
Post a Comment