Siruri De Caractere

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Laurentiu_lambri
L
Laurentiu_lambri
Community Contributor
Quizzes Created: 6 | Total Attempts: 10,095
| Attempts: 1,883 | �ntrebri: 9
Please wait...

Question 1 / 9
0 %
0/100
Score 0/100
1. Fie sirul de caractere s[15]="abracadabra". Ce valoare s-ar afisa la executia intructiunii cout<<strlen(s);

Explanation

The correct answer is 11. In this question, the string "abracadabra" is assigned to the character array s[15]. The strlen() function is used to determine the length of the string, which is the number of characters in the string excluding the null character. Since "abracadabra" has 11 characters, the value 11 would be displayed when executing the cout

Submit
Please wait...
About This Quiz
Siruri De Caractere - Quiz

2. Se consideră variabila s care memorează şirul de caractere CARACATITA. Ce valoare va avea s după executarea instrucţiunii de mai jos? strcpy(s,strstr(s,"TI"));

Explanation

The function `strstr(s, "TI")` searches for the first occurrence of the substring "TI" in the string `s`. The `strcpy(s, ...)` function then copies the found substring and replaces the original string `s` with it. Therefore, after executing the instruction `strcpy(s, strstr(s, "TI"))`, the value of `s` will be "TITA".

Submit
3. Considerăm variabila x care memorează şirul de caractere "ABAC". Care dintre următoarele instrucţiuni conduc la afişarea caracterului B ?

Explanation

The correct answer is "cout

Submit
4. Precizati ce efect ar avea executarea intructiunii cout<<strstr(a,b); daca a="obiect" , b="ie".

Explanation

The execution of the statement "cout

Submit
5. Ce se va afişa în urma executării secvenţei de program alăturate, considerând că s este o variabilă şir de caractere, iar i o variabilă de tip întreg? char a[10]="xmn"; for (i=0;i<=2;i++) strcpy(a+i,a+i+1); cout<<a;

Explanation

The given code snippet initializes a character array "a" with the string "xmn". Then, a loop is executed three times, where the strcpy function is used to copy the character at index "i+1" to the character at index "i" in the array "a". Finally, the content of the array "a" is printed using the cout statement.

In each iteration of the loop, the characters are shifted one position to the left. After the loop finishes executing, the array "a" will contain the string "xmn", which is the correct answer.

Submit
6. Fie sirul cuv, avand urmatorul continut: "portocala". Precizati care va fi continutul acestuia dupa executarea instructiunilor strcpy(a+2 , a+6); a[2]=NULL;

Explanation

The given code snippet is using the strcpy function to copy the characters starting from the 6th position of the string "portocala" into the 2nd position of the same string. After executing this instruction, the string will become "poporala". Then, the code assigns NULL to the 3rd position of the string, resulting in the final content of the string being "po".

Submit
7. Variabila s a fost declarată astfel: char s[20]; Ce se afișează după executarea secvenței de mai jos?   strcpy(s,˝bacalaureat˝); cout<<s;

Explanation

The given code declares a character array variable named "s" with a size of 20. Then, the strcpy function is used to copy the string "bacalaureat" into the variable "s". Finally, the content of variable "s" is printed using the cout statement. Therefore, after executing the given code, the output will be the character 'r'.

Submit
8. Se consideră declararea char e[20]="51+73"; Care este şirul memorat de variabila e după executarea instrucţiunii de mai jos? strcpy(e,strchr(e,'+')) ;

Explanation

The strcpy function is used to copy a string from one location to another. In this case, the source string is "51+73" and the destination string is "e". The strchr function is used to find the first occurrence of a character in a string. In this case, it is used to find the "+" character in the source string. The strchr function returns a pointer to the first occurrence of the character, so the strcpy function will copy everything after the "+" character into the destination string "e". Therefore, the value of "e" after the execution of the instruction will be "+73".

Submit
9. Variabila s este de tip şir de caractere, iar variabilele c1 şi c2 sunt de tip char. Care expresie are valoarea 1 dacă şi numai dacă şirul de caractere s conţine caracterele memorate de variabilele c1 şi c2?

Explanation

The expression "strchr(s,c1)!=0 && strchr(s,c2)!=0" has the value of 1 if and only if the string of characters "s" contains both the characters stored in variables "c1" and "c2".

Submit
View My Results

Quiz Review Timeline (Updated): Mar 21, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Oct 18, 2011
    Quiz Created by
    Laurentiu_lambri
Cancel
  • All
    All (9)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Fie sirul de caractere s[15]="abracadabra". Ce valoare s-ar...
Se consideră variabila s care memorează şirul de caractere...
Considerăm variabila x care memorează şirul de caractere...
Precizati ce efect ar avea executarea intructiunii...
Ce se va afişa în urma executării secvenţei de program...
Fie sirul cuv, avand urmatorul continut: "portocala"....
Variabila s a fost declarată astfel: char s[20]; Ce se afișează...
Se consideră declararea char e[20]="51+73"; Care este şirul memorat...
Variabila s este de tip şir de caractere, iar variabilele c1 şi c2...
Alert!

Advertisement