Interview Question | C Programming Language

  Рет қаралды 2,941,359

Apna College

Apna College

Күн бұрын

Пікірлер: 1 100
@yashpreetsinghkalsi5380
@yashpreetsinghkalsi5380 Жыл бұрын
same question was asked in my internship interview
@Socialmedia......Addiction
@Socialmedia......Addiction Жыл бұрын
Toh answer kya Diya tha?
@rajshiromani727
@rajshiromani727 Жыл бұрын
Tb bhi ans ni pta bhai?? Ans is Hello5😅
@TarunSharma-eq3fg
@TarunSharma-eq3fg Жыл бұрын
@@rajshiromani727 but bhai return 0 ka mtlb to yeh nhi hota ki no. of characters 0 hi print krna (I am new in c language 😅)
@gulhusain6015
@gulhusain6015 Жыл бұрын
​​@@TarunSharma-eq3fgare wo main function ka return type h int main() function hai n isliye return 0 likh rhe Agar void main() likhte to koi value return nhi krani pdti
@TarunSharma-eq3fg
@TarunSharma-eq3fg Жыл бұрын
@@gulhusain6015 oh thanks 😅
@rounakverma8115
@rounakverma8115 10 ай бұрын
This is most common question among all the interviewers, thanku mammm!
@shubh_m1
@shubh_m1 Жыл бұрын
Please keep posting videos like this.
@Sam_sh02
@Sam_sh02 Жыл бұрын
​@@nishagwaliya476???
@thesniperxd5302
@thesniperxd5302 5 ай бұрын
It's nice to see that not only the first printf function prints the hello string but it also returns a value to complete the int x = code which the next printf function prints as 5 ❤
@gaddiji
@gaddiji 18 күн бұрын
whats nice in this?
@peak_911
@peak_911 Жыл бұрын
I think this concept of interview qs type videos is very helpful, can you guys make a playlist for interview qs shorts?
@anshu2005
@anshu2005 Жыл бұрын
Hey I am here to thank universe . The universe helped me in getting a seat in Delhi University. Four rounds had gone and I was with no seat. So I prayed to universe , trusted him , posted letters to him and finally he helped me. I am so thankful to universe.
@ankitmishra697
@ankitmishra697 Жыл бұрын
🙄 Wow bro... ❤
@rudragajjar454
@rudragajjar454 Жыл бұрын
output is: 'Hello 5' since the printf("Hello"); statement will also be executed
@rajshaikh3448
@rajshaikh3448 Жыл бұрын
Bhai bilkul sahi bola
@sky333suraj
@sky333suraj Жыл бұрын
The format specifier %d just prints integer.
@rudragajjar454
@rudragajjar454 Жыл бұрын
@@sky333suraj yes but the 1st line of code is an assignment statement which are executed from right to left. So the RHS of the assignment which is the command printf("Hello"); is executed first and then it's return value i.e 5 is assigned to variable x
@mohammedarifofficial
@mohammedarifofficial Жыл бұрын
I think "hello 5" is the real answer;
@santoshkumargupta6339
@santoshkumargupta6339 11 ай бұрын
Perfect bro
@pavitrakumarsahu2522
@pavitrakumarsahu2522 Жыл бұрын
Didi aapne c language ko bahut achhe se detail se padhaya hai aise aap c plus plus ka padha do n. Hum aap se padhna chahte hai c plus plus. Aapke padhane ka tarika bahut achha hai achhe se samjh me aata hai.
@pavitrakumarsahu2522
@pavitrakumarsahu2522 Жыл бұрын
Please c plus plus ka bhi padha do
@harshahm0130
@harshahm0130 Жыл бұрын
Actually Output is Hello5 because basically printf primarily does its work of printing the text and count the number characters which stores in x
@ratnajaiswal169
@ratnajaiswal169 Жыл бұрын
Is there any way to print only number of characters not the original word in printf ??
@K15H4N
@K15H4N Жыл бұрын
​@@ratnajaiswal169space Instead of word.
@iTsRko_
@iTsRko_ 8 ай бұрын
Hello 5
@kratika83186
@kratika83186 4 ай бұрын
@@ratnajaiswal169 yes indeed , use int x = strlen(“Hello”); and define library function #include
@wildyoutuber2615
@wildyoutuber2615 4 ай бұрын
what is x not output
@introvertsenpai9968
@introvertsenpai9968 Жыл бұрын
Thank you ma'am, I thought I was good at C language but this was something new for me 😊
@NayanW5
@NayanW5 Жыл бұрын
Wow! Each day you learn something new...
@MaaRiGAMINGOP
@MaaRiGAMINGOP Жыл бұрын
First line will give output Hello and assign value to x then second line print 5 combine will be Hello5
@sohamghosh533
@sohamghosh533 Жыл бұрын
Output is "Hello5" not just 5 as it will also execute printf("Hello")
@hitendrachakrawarti5821
@hitendrachakrawarti5821 Жыл бұрын
Yes bro it will excute Hello5
@CHILLBRO-e7y
@CHILLBRO-e7y Жыл бұрын
No
@Vedant_Bharatvasi
@Vedant_Bharatvasi Жыл бұрын
me too
@Ankitkumar-pn2lv
@Ankitkumar-pn2lv Жыл бұрын
Yes hello5
@CHAUDHARY_PRAYAS
@CHAUDHARY_PRAYAS Жыл бұрын
Bhai you are right but she asked what will be printed in place of x not complete o/p
@SubhadipBarik-ps5ii
@SubhadipBarik-ps5ii 2 ай бұрын
Wow! I am a intermediate C programmer student but literally I also think that the result will be error. As the integer variable can't store the character value. Thank you. Aise hi critical programming ka short video upload karte raho 🎉
@अभयदीप-ज1ग
@अभयदीप-ज1ग 27 күн бұрын
Radhe Krishna ji राधे राधे जी
@rishabshukla5077
@rishabshukla5077 Жыл бұрын
We need more like this
@technoprogramming4753
@technoprogramming4753 5 ай бұрын
5 because printed function returns lengthy of a string
@Memer09157
@Memer09157 10 ай бұрын
Let me explain that x: 5 and output : Hello5 Because In c, compiler execute first printf function then it return 5, Hello will print on execution. Then 5 will get assign to x, then last printf function print 5. As there is not any space or new line, it will print as Hello5. Printf function return the no. Of char
@puneeth1217
@puneeth1217 14 сағат бұрын
Nice explaination
@jaykant0007
@jaykant0007 Ай бұрын
it will print Hello5 as output, cause printf("Hello"); print Hello and printf("Hello"); has 5 characters and 5 is stored in x. So output is Hello5.
@akashsonar6332
@akashsonar6332 Жыл бұрын
These small things make big difference in interview..
@ayushthaware344
@ayushthaware344 Жыл бұрын
Hello5 is correct Output The Print statement hello will also be printed, talking about next statement, the length of HELLO that is 5 is printed after that without any space
@divine3832
@divine3832 Жыл бұрын
Those who are saying it prints Hello5, try running only int x= printf("Hello"); It will give 'Hello' as output, and if you write the complete code, it will print 'Hello5', meaning, 5 is the answer that x is returning
@mn-t8u
@mn-t8u Жыл бұрын
Is shows error , bro int x sirf integer leta hai to int x ko ham print hello ko kaise print kr skte
@mansuralikhanpathan4077
@mansuralikhanpathan4077 Жыл бұрын
This video is very useful to meeru 🥳🥳. I hope to find more questions in it, not only in the C language but also in other programming languages for Interview a🙏🏻🙏🏻.
@sayuri_20
@sayuri_20 Жыл бұрын
Sis, You really motivate me to study every time I see you. I like You already.
@kunalmahurkar271il
@kunalmahurkar271il Жыл бұрын
Didi @ApnaCollegeOfficial Correct answer is **Hello 5** Because of %d is used length of *hello* also print.
@shriyanshu_9k
@shriyanshu_9k Жыл бұрын
Yss
@Hbjbmlsi
@Hbjbmlsi 6 ай бұрын
Without space
@advaitgadekar6771
@advaitgadekar6771 6 ай бұрын
But int return only integer walue how hello can home?
@QuanAffinity
@QuanAffinity 4 ай бұрын
Hello5 not Hello 5 no spaces
@purveshmahendrakar2110
@purveshmahendrakar2110 Жыл бұрын
Make a full length video of understanding this type of concepts
@Someone16248
@Someone16248 3 ай бұрын
This is a simple type conversation, the string is a array of character, so it will return the amount of characters it has 😊
@sanket7877
@sanket7877 Жыл бұрын
didi pls aisehi minute concepts which student ignore during interviews , aur laiye. It will be very helpful
@Sattari_01
@Sattari_01 6 ай бұрын
Yr kitni piyri h y...AGR issy hi coding sekhi hoti to aj m programer hota😊
@approgrammingdoor1373
@approgrammingdoor1373 Жыл бұрын
One idea to take is, when we r printing the value of x we also used "%d" which represents an int so the output will be hello5 5 = charector of str.
@meetparmar2107
@meetparmar2107 Жыл бұрын
Int x=(printf("hello world") , 18); Was asked in iit kgp mid sem exam.
@Stay-hard6
@Stay-hard6 Жыл бұрын
i guess that comma is of no use there
@sebastian18059
@sebastian18059 9 ай бұрын
Same cheez hai, hello world hi print hoga
@Hloo-z4w
@Hloo-z4w 3 ай бұрын
What is answer??
@superbikelover01
@superbikelover01 Жыл бұрын
In this question answer is "HELLO 5" BECAUSE value of int x is how many alphabet in Hello and hello is also print
@shikharpahade3959
@shikharpahade3959 Жыл бұрын
Data type is int , so only integer value will be printed
@kanhagarg1525
@kanhagarg1525 Жыл бұрын
Hello5 without space
@DarkMysterioGaming
@DarkMysterioGaming Жыл бұрын
​@@shikharpahade3959no bro
@superbikelover01
@superbikelover01 Жыл бұрын
@@kanhagarg1525 yes but I mention in this comments for understanding "HELLO5" THIS IS REAL OUTPUT
@shriyanshu_9k
@shriyanshu_9k Жыл бұрын
​@@shikharpahade3959bhai practical krke check krle....hello5 print ho rha h
@randomcreations2197
@randomcreations2197 2 күн бұрын
Thanks I could learn this for the first time from this video. But it actually prints 6 as printf also counts the null character '\0' . Correct me please if I'm wrong.❤
@siddheshnarwade3647
@siddheshnarwade3647 4 ай бұрын
As a 12 th std student i m happy to ans the question correctly 😅❤
@ankitrajarya864
@ankitrajarya864 Ай бұрын
Didi ans will be hello 5 ❤❤
@sahilmane2601
@sahilmane2601 11 ай бұрын
Some people are saying that the answer is Hello5 but the question is not that what is the output, but it is that what is x and the value of x is 5, not hello5.
@Hloo-z4w
@Hloo-z4w 3 ай бұрын
Unhone poocha screen pe kya show hoga...
@AjayKumar-xj8in
@AjayKumar-xj8in 18 күн бұрын
Bhai pehla question Sunna karo aacha sa fir Gyan do
@sagaryadu45
@sagaryadu45 Жыл бұрын
Also it is return blank space and integer value ..
@Reactiverahul
@Reactiverahul 5 ай бұрын
In python Output Hello None
@AryanJC07
@AryanJC07 Жыл бұрын
Yup its simple thanks for sharing ❤
@sahilchopde1450
@sahilchopde1450 Жыл бұрын
Answer is " Hello5" not only 5 I also run the program
@Tbm4545
@Tbm4545 Жыл бұрын
Bete usne x ka value pucha hai na ki kya print hoga, Wo jo hello print horaha hao wo uper wali print statement ka ans hai aur uske bad x yani ki 5 print horaha hai, aur udhr new line statement nahi use ki hai isliye wo hello5 ek sath print hoarah hai
@luxrayy2041
@luxrayy2041 11 ай бұрын
​@@Tbm4545yeahhhh
@Hbjbmlsi
@Hbjbmlsi 6 ай бұрын
​@@Tbm4545 oh
@rohansapate3890
@rohansapate3890 Жыл бұрын
We want more such shorts on C and Java.
@jayrawat3929
@jayrawat3929 Жыл бұрын
Meaningful❤
@Gamers-k2l
@Gamers-k2l 5 ай бұрын
Aise hi logic question banate raho mam 😊
@Rama_Siva
@Rama_Siva Жыл бұрын
I run this program/code answer aya - hello5.🤔
@Rama_Siva
@Rama_Siva 10 ай бұрын
​@@vivekdhamande8350 bro character nahi hai eiaha.😂
@sarwanray12
@sarwanray12 10 ай бұрын
Ha bhai answer hello5 hi ayega isme x ka value kya print hoga questions ye hai uska answer hai 5
@PokeBoy-pe8lr
@PokeBoy-pe8lr 7 ай бұрын
I am a beginner. If c++ is an extended of c ,then why we use “printf” and “cout” to output a statement.
@onetofun
@onetofun Жыл бұрын
We want more like this...😇✨
@anycontent4u457
@anycontent4u457 3 ай бұрын
Point 1: Output also includes hello and then 5 will be written like Hello5 Point2: printf also takes 'space' as a character If it was written like "Hello w" then printf will count 5+1+1 = 7 . Output is : Hello w7
@sanatani-aatma
@sanatani-aatma 10 ай бұрын
Samjh to nahi aaya but sunke acha laga 😂😂😂
@bavyagastya2149
@bavyagastya2149 9 ай бұрын
No. Of character bhai printf function me Hello likha hai there is 5 characters in Hello to screen par output 5 aayega simple
@SwingMotor
@SwingMotor 8 ай бұрын
Sanatani ko kab se samaz nhi aa rha ha 😅😅
@anuj-13
@anuj-13 7 ай бұрын
😂😊
@Justanov
@Justanov 7 ай бұрын
​@@SwingMotor 😂😂😂
@Shrutiyadav_108
@Shrutiyadav_108 5 ай бұрын
​@@SwingMotor Jo samjha rahi hai vah bhi sanatani hi hai
@suvammagar5287
@suvammagar5287 5 ай бұрын
output is "hello5" but X is equals to 5
@Syed6579
@Syed6579 Жыл бұрын
Good question ❤
@_mukumemories
@_mukumemories Ай бұрын
For X, it's 5 but actual output will be "Hello 5"
@ratnajaiswal169
@ratnajaiswal169 Жыл бұрын
It prints Hello5... Is there any way to print only number of characters not the original word in printf ??
@jarvis9263
@jarvis9263 9 ай бұрын
#include int main() { // Write C code here int x = printf("Hello "); printf("%d ",x); return 0; } output ---> Hello 6
@Exposing.official.
@Exposing.official. 3 ай бұрын
correct
@AkankshaSumanofficial
@AkankshaSumanofficial Ай бұрын
Plz explain in words, if possible
@Exposing.official.
@Exposing.official. Ай бұрын
@@AkankshaSumanofficial I will explain you in a while . I’m busy right now
@AkankshaSumanofficial
@AkankshaSumanofficial Ай бұрын
@@Exposing.official. oh, thank you so much
@Exposing.official.
@Exposing.official. Ай бұрын
@@AkankshaSumanofficial The code prints "Hello" and then a number on the next line. The printf("Hello ") function prints "Hello" and returns the number of characters it printed (6, including the newline ). This return value (6) is stored in the variable x. Then, printf("%d ", x) prints the value of x, which is 6.
@Maryam-y1j
@Maryam-y1j 8 ай бұрын
Thank you! I have learned from this video. ❤
@bhavyashah7904
@bhavyashah7904 Жыл бұрын
on screen it will display "Hello 5"
@boydista_307
@boydista_307 Ай бұрын
We can change int main to void main, then there will be no need to write any return value
@cheenu2064
@cheenu2064 Жыл бұрын
Output will be Hello5👍
@shriyanshu_9k
@shriyanshu_9k Жыл бұрын
Yss
@Anemptysoul
@Anemptysoul 10 ай бұрын
The answer is not only 5 . It's hello5 as printf("hello"); statement will also execute.
@AkashSupkar-io9up
@AkashSupkar-io9up 5 ай бұрын
'X'usiko kahata ha jo hame chor ka chali jati ha 😢😅
@VishalSingh-nn4ne
@VishalSingh-nn4ne 10 ай бұрын
%d indicates the integer value thats why 5 will be print
@princepexz
@princepexz Жыл бұрын
Intresting
@shubhangiagarkar1708
@shubhangiagarkar1708 6 ай бұрын
Certainly! Here's the corrected code that stores the value returned by `printf` in `x` and returns it: ```c #include int main() { int x = printf("hello"); printf("%d", x); return x; } ``` This code prints the length of the string "hello" followed by its actual length, and then returns the value of `x`. So the output will be: ``` hello5 ``` And the return value of the program will be `5`.
@Aarya_x12
@Aarya_x12 Жыл бұрын
OUTPUT (Hello5) aa rha h
@ankitkumar-qi3cd
@ankitkumar-qi3cd 8 ай бұрын
correct bro, qki phle first wala printf apna Hello print krega, phir baad me next wala printf X ki value print krega :-) then output aayega Hello5
@rohityadavmudra
@rohityadavmudra Жыл бұрын
IT IS HELPFUL, MAJE MORE SUCH VIDEO'S LIKE THIS ✅♥️🙏
@HarshPatel-sk5fd
@HarshPatel-sk5fd Жыл бұрын
output is Hello5
@shubhamraut9339
@shubhamraut9339 Жыл бұрын
Hello 5 , space Miss kar diya tune😊😅
@mukherjee.p
@mukherjee.p 4 ай бұрын
There's nothing to "think" about this. If you know you know lol. You may not be able to just guess the return value out of a random function (random because you typically wouldn't use it like this) right. Typically in systems languages, they usually return the "number of bytes written" from printing or writing functions. So there's that.
@CaptainCoder1
@CaptainCoder1 Жыл бұрын
Quite simple problem for those who atleast knows the function signature of printf function it return an integer which is equal to number of characters that it has successfully printed in the console screen.
@tgayush1424
@tgayush1424 Жыл бұрын
Bring more videos like this, or make a large video like this , this types of questions come in OA , and the prefix and postfix thing also common...
@MdRakibulhasan-dq5dh
@MdRakibulhasan-dq5dh Жыл бұрын
yes the x value is 5 .if we get this code output .than we have hello5 output
@AmarShinde-b8v
@AmarShinde-b8v 11 ай бұрын
X is an variable and it's stored the statement that are *hellow world*.
@SidsAnalysis
@SidsAnalysis 10 ай бұрын
Jo printable cheeje hongi unka count number print hoga Jaise isme Hello ye sare printable hain Isiliye iska answer 5 aayega However isme \0 null character bhi hai but vo printable nhi hai isiliye vo is count me nhi add hoga
@AyoubTahlilHersi
@AyoubTahlilHersi 5 ай бұрын
Int is an integer and not a character so only the number 5 will be printed as opposed to being an array of characters [ ] such as hello which is 5 characters. so printf function of hello will be printed and then the number of characters in number "5"
@VirenderJi-gs2qs
@VirenderJi-gs2qs 5 ай бұрын
Indeed
@niranjanniru4115
@niranjanniru4115 3 ай бұрын
its simple that you can uderstang that int datatype always return numbers
@AponZaman-i70
@AponZaman-i70 12 күн бұрын
No( printf 5 )it will not return anything because we don't give any number in x It will print (0) 😊 i think that, now you tell us what is the answer and im new in c programming 😊
@khazeemakanwal7213
@khazeemakanwal7213 Жыл бұрын
We want more this type of questions n this answer Thank u didi
@mrpaulcreations2172
@mrpaulcreations2172 Жыл бұрын
5 , print function returns the length of the printed string
@monsterudhay1435
@monsterudhay1435 21 күн бұрын
4 it gives the number of printable characters
@monsterudhay1435
@monsterudhay1435 21 күн бұрын
It's gives 5 including \0
@deepakmodi9343
@deepakmodi9343 Жыл бұрын
Mybe answer is 1(if printf is boolean function) Or mybe ascii value of each digit Or maybe somekind of binary no. Edit: 😕
@AkankshaSumanofficial
@AkankshaSumanofficial Ай бұрын
Plz provide some more shorts on C programming
@TonyStark-zl3ms
@TonyStark-zl3ms Жыл бұрын
Thank you mam...keep uploading these types of questions...it enhances our knowledge and help us to clear the interview ❤❤😊
@yuvrajpinkman
@yuvrajpinkman 10 ай бұрын
mujhe ye mila tha , answer will be hello 5 (space because _%d) otherwise hello5
@muhammad_saad_007
@muhammad_saad_007 3 ай бұрын
Hello5 not just 5 because we are printing the string too
@anurag-bh2ug
@anurag-bh2ug 9 ай бұрын
We want more videos like this😊
@Nature20078
@Nature20078 5 ай бұрын
4 is the answer.....because hello 0,1,2,3,4
@B_story4u
@B_story4u 26 күн бұрын
its same as strlen() but without essy to use🎉
@garimatiwari765
@garimatiwari765 Жыл бұрын
Ma'am answer 5 because c language as string character form convert
@khizraaaah.__
@khizraaaah.__ 3 ай бұрын
Beauty with brain❤
@SachinUPSC3
@SachinUPSC3 2 ай бұрын
No "Hello 5" is output don't forgot space before 5
@harshjan1896
@harshjan1896 9 ай бұрын
5 bcoz string hello has five char.
@anildaharwal2013
@anildaharwal2013 7 ай бұрын
Str_1='Hello' Str_1=Len() Ans 5
@StaticTechnology
@StaticTechnology 9 ай бұрын
This is not logic test. This is how much memory you have in your mind.
@user-xb3my6zw6r
@user-xb3my6zw6r 4 ай бұрын
5?The answer should be Hello only right. Because we aren't giving any other command to print number of characters of the string.
@learningfiru
@learningfiru 7 ай бұрын
hey mam ; may the R8 answer will be "hello5"
@advaitgadekar6771
@advaitgadekar6771 6 ай бұрын
But int return only integer walue how hello can home?
@ClashWithHuzefa
@ClashWithHuzefa Жыл бұрын
This trick can be used to find the length of strinf
@Gear_5five
@Gear_5five 2 ай бұрын
The ans is :_5 where (_) is space where printf("_%d"); there was a space there ans is a little bit of space 5
@ramjiyadav5147
@ramjiyadav5147 8 ай бұрын
Outstanding shradhha ji
@swanandlaghate5113
@swanandlaghate5113 Жыл бұрын
मॅडम, मैं भी १२-१३ साल से programming languages पढ रहा, उनमे काम कर रहा हू मगर ये बात मुझे आज पता चली, thanks for updating me! मगर interviewer ये सवाल क्यो ऑर किस लिये पूछता ? इसका कंपनी के कोई भी काम मे उपयोग ही नही???
@callofactiongamingchannel2125
@callofactiongamingchannel2125 2 ай бұрын
huh, matlab jitne character ka word hoga ye usse utne number me convert karke value provide karega?
@Raviverma12398
@Raviverma12398 Жыл бұрын
Didi answer is "Hello5"
@sachinkryadav26
@sachinkryadav26 Жыл бұрын
Hello 5 is correct output not only 5
If I Wanted a Software Engineering Placement in 2025, I’d Do This
17:51
How to Study MORE in LESS TIME 🔥 | 5 Principles | for students
11:27
😜 #aminkavitaminka #aminokka #аминкавитаминка
00:14
Аминка Витаминка
Рет қаралды 2 МЛН
🕊️Valera🕊️
00:34
DO$HIK
Рет қаралды 14 МЛН
버블티로 부자 구별하는법4
00:11
진영민yeongmin
Рет қаралды 26 МЛН
Which Coding Language should you start with in 2024? For Beginners
10:19
Apna College
Рет қаралды 1,4 МЛН
How to make Notes for Coding? Data Structures & Algorithms
19:29
Apna College
Рет қаралды 1,5 МЛН
Learn C Language In 10 Minutes!! C Language Tutorial
10:36
AmanBytes
Рет қаралды 368 М.
Palestine Must Be Free | Stand-up Comedy by Daniel Fernandes
15:07
Daniel Fernandes
Рет қаралды 88 М.
She said Yes | @AmanDhattarwal & Shradha Ma'am
16:48
Aman Dhattarwal
Рет қаралды 5 МЛН
Python for Beginners - Learn Python in 1 Hour
1:00:06
Programming with Mosh
Рет қаралды 19 МЛН