Become a GOLD member of Deccansoft and get access to 40+ courses!!
NewBatches/Webinars
Packages
Gold Membership
Bestseller
Microsoft Azure Suite & Suite Plus
Power Platform Acadamy
New
Azure DevOps Expert & Expert Plus
MS.NET Foundation For Beginners
MS.NET Full Stack Developer
UI / Web Development
SQL Server & MSBI Tools
Software Testing
Courses
MS.NET Courses (Includes Live Project)
Complete C#, OOPs and Windows Programing
ASP.NET MVC Online Training
ASP.NET WebForms
ASP.NET Core
WCF incl. Web Services and Remoting
WPF incl. MVVM and Prism
LINQ and Entity Framework
Live Project Training for Developing Enterprise Application
Live Project using Ntier Arch (.NET5 + EF Core + Angular)
Microservices using .NET Core
Gold Membership
CareerStep IT Program
Client-side UI Technologies
Building Static Web Pages using HTML and CSS
JavaScript and HTML DOM
jQuery, AJAX and JSON
Building Interactive Web Pages using HTML5 and CSS3
BootStrap + Live Examples
AngularJS + Live Project
Angular + Typescript
ReactJS
KnockoutJS
Xamarin
SQL Server + MSBI
SQL Server 2017
Querying Data with Transact-SQL(70-761)
SQL Server Integration Service (SSIS)
SQL Server Reporting Service (SSRS)
SQL Service Analysis Service (SSAS)
Cloud Computing / Azure / AWS
AZ-900: Microsoft Azure Fundamentals
Azure Suite (AZ-104+AZ-204+AZ-305+ AZ-500)
AZ-104: Microsoft Azure Administrator
AZ-204: Developing Solutions for Microsoft Azure
AZ-305: Microsoft Azure Architect Technologies and Design
DP-203: Data Engineering on Microsoft Azure
Amazon Web Services (AWS)
DevOps Expert
AZ-400: Microsoft Azure DevOps
Docker by Sandeep Soni
Kubernetes by Sandeep Soni
Docker & Kubernetes by Rahul Rampurkar
IaC Using Terraform
Powershell
Microsoft Power Platform
Microsoft Power Platform
Data Analytics using PowerBI (DA-100)
Testing Tools
Manual Testing
Selenium Testing with Java(Live Training)
Others
Python Programming
C and Data Structure
Core Java
OOPs and C++
Advance Java
Complete Azure Training
Pricing
Videos
Testimonials
Azure Certification
Contact Us
Login
Login or Register
×
Sign In
Register
Forgot Password?
How did you find us
WhatsApp
YouTube
LinkedIn
Facebook
Telegram
Twitter
Google
Referred by Friend
Refresh
Input symbols
By clicking Register, you accept to the
terms and conditions
and that you have read our
privacy policy.
Recover Password
×
Submit
Enquiry Now
Where did you come to know about us
WhatsApp
YouTube
LinkedIn
Facebook
LinkedIn Ad
Email
Twitter
Google
Referred
Other
Refresh
Input symbols
String Handling
Interview Questions and Answer
1. Which is the data type used to declare the strings?
Options:
a. strings
b. character
c. integer
d. none of above
Reveal Answer
2. Which of the following declaration is correct to declare the strings?
Options:
a. char city[10];
b. char city;
c. Char []city;
d. None of above
Reveal Answer
3. In C every string ends with ------------ character
Options:
a. \0 (Null)
b. \t tab space
c. \n newline
d. 0
Reveal Answer
4. Which one of the following string Initialization are correct?
Options:
a. char name[10] = { 'A', 'l', 'a', 'b', 'a', 'm', 'a', '\0' };
b. char *name = { 'A', 'l', 'a', 'b', 'a', 'm', 'a' };
c. char name={“Alabama”};
d. char *name={“A”,”l”,”b”,”a”,”m”};
Reveal Answer
5. What will be the output of the above program? #include<stdio.h> void main() { char str1[]="Hello"; char str2[10]="hai"; str2=str1; printf(“%c”,str2); }
Options:
a. Hello
b. Hai
c. Compilation Error
d. Runtime Error
Reveal Answer
6. What will be the output of the above program? #include<stdio.h> void main() { char *s = "Good morning"; char *p; p = s; puts(p); return 0; }
Options:
a. Good
b. Good Morning
c. Compilation Error
d. Runtime Error
Reveal Answer
7. What will be the output of the below program? #include<stdio.h> int main() { char *str1="Hello"; str1="bye"; printf(str1); return 0; }
Options:
a. bye
b. No output
c. Error
d. None of above
Reveal Answer
8. Which format specifiers are used to read the strings
Options:
a. %s
b. %c
c. %g
d. %l
Reveal Answer
9. How many types of string handling mechanism are available?
Options:
a. 6
b. 5
c. 4
d. 7
Reveal Answer
10. In which one of the following function will copy the one string to another string. Strcpy() Strcmp() Strchr() Strstr()
Options:
a. Strcpy()
b. Strcmp()
c. Strchr()
d. Strstr()
Reveal Answer
11. When initializing a string variable during its declaration, we must include the null character as part of the string constant, like ‘GOOD\0’.
Options:
a. True
b. False
Reveal Answer
12. The gets function automatically appends the null character at the end of the string read from the keyboard.
Options:
a. True
b. False
Reveal Answer
13. When reading a string with scanf, it automatically inserts the terminating null character.
Options:
a. True
b. False
Reveal Answer
14. String variables cannot be used with the assignment operator.
Options:
a. True
b. False
Reveal Answer
15. We cannot perform arithmetic operations on character variables.
Options:
a. True
b. False
Reveal Answer
16. In the ASCII collating sequence, the uppercase letters precede lowercase letters. True False
Options:
a. True
b. False
Reveal Answer
17. In C, strings cannot be initialized at run time.
Options:
a. True
b. False
Reveal Answer
18. The input function gets has one string parameter.
Options:
a. True
b. False
Reveal Answer
19. The function call strcpy (s2, s1); copies string s2 into string s1.
Options:
a. True
b. False
Reveal Answer
20. The function calls strcmp (‘abc’, ‘ABC’); returns a positive number.
Options:
a. True
b. False
Reveal Answer
21. What will be the output of the following statements? #include<stdio.h> #include<string.h> int main() { printf("%d",strcmp("push", "pull")); }
Options:
a. 23
b. 7
c. 1
d. 17
Reveal Answer
22. Assume that s1, s2 and s3 are declared as follows: #include<stdio.h> #include<string.h> int main() { char s1[10]= "he",s2[20]= "she", s3[30], s4[30]; printf("%s\n", strcpy(s3, s1)); printf("%s\n", strcat(strcat(strcpy(s4,s1),"or"),s2)); printf("%d %d",strlen(s2)+strlen(s3),strlen(s4)); }
Options:
a. he heorshe 5 7
b. heorshe 5 7
c. 5 7
d. he heorshe
Reveal Answer
23. What will be the output of the following segment? char s1[]= “Kolkata”; char s2[]= “Pune”; strcpy(s1, s2); printf(“%s”,s1);
Options:
a. Kolkata
b. Pune
c. Hyderabad
d. Mabaka
Reveal Answer
24. What will be the output of the following segments? char s1[]= “NEW DELHI”; char s2[]= “BANGALORE”; strcpy(s1, s2, 3); printf(“%s”, s1);
Options:
a. NEW DELHI
b. Compilation Error
c. BANGALORE
d. NEW DELHI BANGALORE
Reveal Answer
25. int main() { static char s[]=”Rendezvous !”; printf(“%d”,*(s+strlen(s))); return 0; } What will be the output of the above program?
Options:
a. No output
b. 10
c. 0
d. 9
Reveal Answer
Packages
Gold Membership
Microsoft Azure Suite &Suite Plus
Azure DevOps Expert &Expert Plus
MS.NET Foundation For Beginners
MS.NET Full Stack Developer
UI / Web Development
SQL Server & MSBI Tools
Software Testing
Resources
Blog
Deccansoft
AzureA2Z
Wall of Fame
On-Job Tech Support
About
About BestDotNetTraining
About Trainer
Testimonials
FAQ
Other links
About Us
Contact Us
Leave us a feedback
Sitemap
Privacy Policy
Terms & Conditions
Proudly Powered by