c interview questions – StudyObject https://www.studyobject.com Social Learning Circle Sat, 07 Aug 2021 16:29:57 +0000 en-US hourly 1 https://wordpress.org/?v=5.5.15 https://www.studyobject.com/wp-content/uploads/2019/06/cropped-feat4-32x32.png c interview questions – StudyObject https://www.studyobject.com 32 32 C Interview Questions | StudyObject https://www.studyobject.com/c-interview-questions/ Sat, 11 Apr 2020 07:49:38 +0000 https://www.studyobject.com/?p=1278 C interview questions are basic questions but are tricky. We are providing the list of 10 C interview questions with …

The post C Interview Questions | StudyObject appeared first on StudyObject.

]]>
C interview questions are basic questions but are tricky. We are providing the list of 10 C interview questions with answers.

C questions are mostly of program type so practice these questions.

1.What is the difference between sizeof and strlen in C

#include<stdio.h>
int main()
{
char a[]=”hello”;
char *p=”hello”;
printf(“%d—%d—“,sizeof(a),strlen(a));
printf(“%d—%d”,sizeof(p),strlen(p));
return 0;
}
Output:
6—5—4—5
Pointer always returns its size with sizeof
Sizeof operator includes “null” at the end of string

2.write a program to do string reversal without pointer.

#include<stdio.h>
#include<string.h>int main() {
char A[100]=”ITTINA”, temp;
int i, j = 0;printf(“nEnter the string : %s” , A);i = 0;
j = strlen(A) – 1;while (i < j) {
temp = A[i];
A[i] = A[j];
A[j] = temp;
i++;
j–;}printf(“nafter reversal: %s” , A);}

3.write a program for string reversal using pointers
write a program to reverse the string using pointers

#include<stdio.h>
#include<string.h>void reverse(char* p);int main()
{char p[]=”hello”;reverse(p);printf(“%s”,p);return 0;
}
void reverse(char* p)
{
char *start = p;
char *end = p+strlen(p)-1;
char tmp;
while(end>start)
{
tmp=*end;
*end=*start;
*start=tmp;
start++;
end–;
}
}

4.write a program to reverse a string using recursion

#include<stdio.h>char * rev(char *);
int main()
{
char A[10] = “HELLO”;
printf(“%s”,A);
char *p = rev(A);
printf(“—–>%s”,p);return 0;
}char* rev(char *p)
{
static int i=0;
static char m[10];if(*p)
{
rev(p+1);
m[i++]=*p;}return m;
}

5.what happens when NULL pointer is derefernced.

#include<stdio.h>
int main()
{
int *p=NULL;
printf( “printing p %d”,*p);
}
NULL points to 0x00 which is protected by kernal so it does nt allow it to derefence
Output:-
Segmentation fault

6.what is the output of below program

#include<iostream>int main()
{char *p=”HELLOn”;printf(“%s”,p);printf(p);printf(“HELLO”);}Output:-
HELLO
HELLO
HELLO

7.write a program to find if a processor is little endian or big endian

#include<stdio.h>
int main()
{
int a= 0x12345678;
char *p=(char*)&a;
printf(“%x”,*p);
if (*p==0x78)
printf(“little endian”);
}
Output:
78little endian

8.write your own atoi program

atoi converts string to integer value
#include <stdio.h>
int Atoi(char *mystring)
{
int result = 0;
int i;
for ( i = 0; mystring[i] != ‘�’; ++i)
{
result = result*10 + mystring[i] – ‘0’; // ‘0’ is 48 – we need to subtract 48 from each assci to get the integer
}
return result;
}
int main()
{
char mystring[] = “194567”;
int finalvalue = Atoi(mystring);
printf (“%d “, finalvalue);
return 0;
}
Output-
194567

9.compare your own atoi with original atoi

Always remember original atoi in std lib does nt process characters like abcd and if given alongwith integer it silently ignores it
#include <stdio.h>
#include <stdlib.h> /* atoi */
int Atoi(char *mystring)
{
int result = 0;
int i;
for ( i = 0; mystring[i] != ‘�’; ++i)
{
result = result*10 + mystring[i] – ‘0’;
}
return result;
}
int main()
{
char mystring[] = “123a”;
int finalvalue = Atoi(mystring);
printf (“%dn “, finalvalue);
int at =atoi(mystring);
printf (“%d “, at);
return 0;
}
Output:-
1279
123

10.Explain function pointer by writing a program

#include<stdio.h>
int display();
int main()
{
int (*functionPtr)(); //declaration of function pointer
functionPtr=display;
(*functionPtr)(); //making a call to function via function pointer
}
int display()
{
printf(“Function pointer explained”);
}
Output:-
Function pointer explained

The post C Interview Questions | StudyObject appeared first on StudyObject.

]]>
Internship at Studyobject https://www.studyobject.com/internship-in-whitefield/ Sun, 05 Apr 2020 08:05:13 +0000 http://themes.vibethemes.com/wplms/skins/demo2/?p=1891 Our internship program detail Number of Interns required – 2 Qualification Needed:- 1.Solid understanding of algorithms, operating system. Good knowledge of …

The post Internship at Studyobject appeared first on StudyObject.

]]>
Our internship program detail

Number of Interns required – 2

Qualification Needed:-

1.Solid understanding of algorithms, operating system. Good knowledge of html, css, php, mysql .Experience in writing high quality code.

2.Proactive with eager to learn new technologies.

3.Students in 3rd year/ final year of B.TECH/ Fresh B.Tech Pass-out from Tier- 1/Tier-2 college

4.Personal Interview will be done remotely via videocall.

5.The internship period is for 3 months.

Benefits of internship at our office

1.Internship includes real life problem solving and building blocks for career.

2.Learn from industry experts

3.Learn more in startup culture.

4.Internship Experience Certificate

Contact – [email protected]

The post Internship at Studyobject appeared first on StudyObject.

]]>