+ 2

What does this question trying to ask?

One of the C challenge questions is: "Which of the following mode argument is used to truncate?" โ—‹ a โ—‹ t โ—‹ w โ—‹ f what is a "mode argument" and how does it differ from a normal function argument? If one of the answers going to be an argument, what is the function and what is truncation about?

24th Sep 2022, 12:12 PM
Tina ๐Ÿ•Š๐Ÿ‡บ๐Ÿ‡ฆ๐Ÿ‡ฎ๐Ÿ‡ท
Tina ๐Ÿ•Š๐Ÿ‡บ๐Ÿ‡ฆ๐Ÿ‡ฎ๐Ÿ‡ท - avatar
13 Answers
+ 2
In case of fopen() and its variants - "a" and "w" are common, but "t" and "f" are not as common. Perhaps I missed its definition somewhere, but neither cppreference nor man page had their definition.
24th Sep 2022, 12:29 PM
Ipang
+ 2
Ipang where does it mentioned fopen() ?
24th Sep 2022, 12:45 PM
Tina ๐Ÿ•Š๐Ÿ‡บ๐Ÿ‡ฆ๐Ÿ‡ฎ๐Ÿ‡ท
Tina ๐Ÿ•Š๐Ÿ‡บ๐Ÿ‡ฆ๐Ÿ‡ฎ๐Ÿ‡ท - avatar
+ 2
Nowhere Tina ๐Ÿ•Š๐Ÿ‡บ๐Ÿ‡ฆ ๐Ÿ˜ But the first thing that came to me upon "mode argument" was the fopen() function because it has an argument named 'mode', and the word "truncate" sounded like - open file for read/write and reset the file to zero bytes. I can't think of other possibility where 'mode' and "truncate" relates, for now.
24th Sep 2022, 1:33 PM
Ipang
+ 2
TYSM Ipang ใ€‹Nowhere But the first thing that came to me upon "mode argument" was the fopen() function because it has an argument named 'mode' Yes, fopen() and many other functions have an argument called "mode" but only some do truncate a file. FYI int open(const char *pathname, int mode); FILE *fopen(const char *path, const char *mode); int creat(const char *pathname, mode_t mode); int chmod(const char *path, mode_t mode); int mkdir(const char *pathname, mode_t mode); int faccessat(int dirfd, const char *pathname, int mode, int flags); int access(const char *pathname, int mode); ... An argument, can't exsist without a function, and it is missing in the question.Also there's not a clue that q. is about files. ใ€‹and the word "truncate" sounded like - open file for read/write and reset the file to zero bytes. That is what you think, almost all data structures and types can be truncated... Whoever can answer this question as it is, should be able to code a solution for an unknown problem.
25th Sep 2022, 4:11 AM
Tina ๐Ÿ•Š๐Ÿ‡บ๐Ÿ‡ฆ๐Ÿ‡ฎ๐Ÿ‡ท
Tina ๐Ÿ•Š๐Ÿ‡บ๐Ÿ‡ฆ๐Ÿ‡ฎ๐Ÿ‡ท - avatar
+ 2
Tina ๐Ÿ•Š๐Ÿ‡บ๐Ÿ‡ฆ You are forgetting one thing. Although there are many functions declared with argument named 'mode' the fopen() is the one that is covered in the tutorial, despite of lacking for details and very simple example. If SoloLearn or the quiz poster were referring to either one of the other functions, then it's not right because the tutorial had not include any example involving any of the other functions you listed. It's like testing students with a subject they never learned.
25th Sep 2022, 5:38 AM
Ipang
+ 2
Tina ๐Ÿ•Š๐Ÿ‡บ๐Ÿ‡ฆ You know that you'd have to express your objection to SoloLearn right? none of us in community has the right to take down a quiz even when it was found faulty.
25th Sep 2022, 12:33 PM
Ipang
+ 2
Ipang Sure I know and I already did it. Just like my previous question. But I still see these, most likely because a single report doesn't have much impact, perhaps others just don't care about the content quality and accuracy. you'll get more disappointed when a mentor insists that a totaly wrong answer is correct. maybe I shouldn't waste my time either and deliberately choose the wrong answer.
25th Sep 2022, 2:55 PM
Tina ๐Ÿ•Š๐Ÿ‡บ๐Ÿ‡ฆ๐Ÿ‡ฎ๐Ÿ‡ท
Tina ๐Ÿ•Š๐Ÿ‡บ๐Ÿ‡ฆ๐Ÿ‡ฎ๐Ÿ‡ท - avatar
+ 2
Tina ๐Ÿ•Š๐Ÿ‡บ๐Ÿ‡ฆ That sadly is what the game was about for the many; it's all about points and levels. Disregarding any emblems, any person has equal rights to speak their mind. Nevertheless, the wrong should be wrong, just as the right should be right IMHO. Also I don't think speaking up on a faulty or unclear quiz was a waste of time. It's an attempt to make things better, when done in proper way. We shouldn't let a mistake be written in history, for the future's sake obviously. Standing up for the right thing was never anything easy, but it doesn't mean we shouldn't try to ...
25th Sep 2022, 9:28 PM
Ipang
+ 2
Azhagesanใƒพ(โœฟ) well, the point is if you're going to make a question or answer one, it should be clear, precise and testable. This way eveyone can examine it. I mean, after all, it's programming and concrete facts, not some gibberish philosophical theories. Thank you for pointing out the MCQs, I found it, but even there this q is in "file access" section among a bunch of other file manipulation questions. even there, it's not obviously clear, but one hardly would have a doubt. again, ty. https://www.sanfoundry.com/c-programming-questions-answers-file-access-1/
28th Sep 2022, 4:59 AM
Tina ๐Ÿ•Š๐Ÿ‡บ๐Ÿ‡ฆ๐Ÿ‡ฎ๐Ÿ‡ท
Tina ๐Ÿ•Š๐Ÿ‡บ๐Ÿ‡ฆ๐Ÿ‡ฎ๐Ÿ‡ท - avatar
+ 1
https://www.geeksforgeeks.org/trunc-truncf-truncl-c-language/
24th Sep 2022, 12:24 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Ipang No, I haven't forget, but you pointed out good things, "quiz poster, testing students" if it was clear that the question is about fopen() and file truncation (which is covered in SL course, and doesn't matter if it's the only one or there are a bunch), then it was acceptable to test if they know 'w' is the answer. But it's not, again, no signs of file nor fopen(). otherwise quiz poster doesn't know any other type of function and truncation or: he wants to ask about file truncation but by posting in this form it forces a reader to think there's a special type of argument, that thing is called "mode argument" in C, and there are 4 of them: a,t,w,f, and one is used to truncate just something.
25th Sep 2022, 8:08 AM
Tina ๐Ÿ•Š๐Ÿ‡บ๐Ÿ‡ฆ๐Ÿ‡ฎ๐Ÿ‡ท
Tina ๐Ÿ•Š๐Ÿ‡บ๐Ÿ‡ฆ๐Ÿ‡ฎ๐Ÿ‡ท - avatar
+ 1
Tina ๐Ÿ•Š๐Ÿ‡บ๐Ÿ‡ฆ In this question they didn't mention file directly but modes are given as arguments to give permission to change content in file. We need write(w or similar) permission to change truncated values in file. https://www.sololearn.com/Discuss/1666814/?ref=app This question was simply copied from MCQ websites for some fancy badges
26th Sep 2022, 11:05 AM
Azhagesanใƒพ(โœฟ)
Azhagesanใƒพ(โœฟ) - avatar
0
Yaroslav Vernigora the page you referred me to is about decimal numbers and trunc*() functions. the answers all are single char, perhaps you can re-read my question. btw, thank you.
24th Sep 2022, 12:44 PM
Tina ๐Ÿ•Š๐Ÿ‡บ๐Ÿ‡ฆ๐Ÿ‡ฎ๐Ÿ‡ท
Tina ๐Ÿ•Š๐Ÿ‡บ๐Ÿ‡ฆ๐Ÿ‡ฎ๐Ÿ‡ท - avatar