
Strings em C
Authored by Gabriel Gomes
Computers
11th Grade
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
13 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Cada caractere da string é armazenado em um índice. Essa afirmação é:
Verdadeira
Falsa
Answer explanation
As strings funcionam como um vetor de caractéres, portanto cada caractere da string é salvo em um indíce próprio, de forma sequencial na memória.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Qual caractere que representa o elemento nulo?
!N
!=
\0
\N
Answer explanation
Em C, o caractere que representa o elemento nulo é ' \0 '. Ele é usado para marcar o final de uma string, indicando ao programa onde a string termina. Ou seja, ele sucede o último caractere válido de uma string.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Qual a sintaxe correta da função fgets para ler 100 caracteres de uma string "frase"?
fgets(frase, 100, %s);
fgets(frase, 100, stdin);
fgets(100, frase, %c);
fgets(100, frase, input);
Answer explanation
A sintaxe correta da função fgets é: o nome da string, seguido pela quantidade de caractéres que serão lidos e stdin (indica que a entrada de texto vem do teclado).
Importante frisar que durante a leitura de uma string usando fgets, pode ocorrer que o caractere "\n" (enter) fique armazenado nela.
4.
FILL IN THE BLANK QUESTION
45 sec • 1 pt
Qual a função responsável por imprimir uma string seguida de uma nova linha? Escreva o nome dela!
Answer explanation
A função puts é utilizada para imprimir uma string seguida automaticamente por uma nova linha.
Ela imprime SOMENTE a string, portanto não aceita formatação como printf.
A função puts é utilizada para imprimir uma string seguida automaticamente por uma nova linha.
Ela imprime SOMENTE a string, portanto não aceita formatação como printf.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Como podemos obter o comprimento de uma string em C?
strlength(string)
size(string)
strsize(string)
strlen(string)
Answer explanation
A função strlen() é usada para calcular o comprimento de uma string, ou seja, o número de caracteres contidos nessa string.
Ela percorre a string até encontrar o elemento nulo, retornando assim um valor do tipo inteiro.
Portanto, podemos salvar o valor de strlen em outras variáveis, como no exemplo.
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Como podemos comparar duas strings em C?
strcom(string1, string2)
strcmp(string1, string2)
strcom(string1 == string 2)
strcmp(string1 == string2)
Answer explanation
A função strcmp() é usada para comparar duas strings e determinar se são iguais ou qual delas é maior em ordem alfabética.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Ao usar a função strcmp, ela retornou um VALOR POSITIVO. Isso significa que:
As strings são iguais
A primeira string tem mais caracteres que a segunda
A primeira string é maior em ordem alfabética que a segunda
A segunda string é maior em ordem alfabética que a primeira
Answer explanation
A função strcmp retorna um valor do tipo inteiro:
0 (zero) se as strings forem iguais;
1 (valor positivo) se a primeira string for maior em ordem alfabética (vier depois no alfabeto);
0 (valor negativo) se a segunda string for maior em ordem alfabética.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
Python Variables
Quiz
•
7th - 12th Grade
15 questions
Code.org Unit 5 Lesson 15 Assessment
Quiz
•
9th - 12th Grade
16 questions
Python Review
Quiz
•
9th - 12th Grade
10 questions
C#
Quiz
•
11th Grade
15 questions
Hardware e software
Quiz
•
11th - 12th Grade
10 questions
Code.org Unit 5 Vocab Quiz 1
Quiz
•
9th - 12th Grade
10 questions
Variables and Data Types
Quiz
•
10th - 12th Grade
10 questions
Website Development 1 - Recall
Quiz
•
11th Grade
Popular Resources on Wayground
8 questions
2 Step Word Problems
Quiz
•
KG - University
20 questions
Comparing Fractions
Quiz
•
4th Grade
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Latin Bases claus(clois,clos, clud, clus) and ped
Quiz
•
6th - 8th Grade
22 questions
fractions
Quiz
•
3rd Grade
7 questions
The Story of Books
Quiz
•
6th - 8th Grade
Discover more resources for Computers
8 questions
2 Step Word Problems
Quiz
•
KG - University
10 questions
Martin Luther King, Jr. For Kids
Interactive video
•
1st - 12th Grade
10 questions
Dr. King's Speech and Its Impact
Interactive video
•
7th - 12th Grade
20 questions
-AR -ER -IR present tense
Quiz
•
10th - 12th Grade
10 questions
Los mandatos y las recetas
Lesson
•
11th Grade
7 questions
Anti-Bullying ARS 15-341
Quiz
•
9th - 12th Grade
13 questions
Model Exponential Growth and Decay Scenarios
Quiz
•
9th - 12th Grade
15 questions
TSI Math Practice Questions
Quiz
•
8th - 12th Grade