IT 122: Introduction to C Programming - Scope Rules Quiz

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the correct way to declare the Book structure?

  • struct Book { char title; char author; char subject; int book_id; } Books;
  • Books { char title; char author; char subject; int book_id; } struct Book;
  • struct Books { char title; char author; char subject; int book_id; } book; (correct)
  • Book { char title; char author; char subject; int book_id; } struct Books;

Which function is used to copy a string in C?

  • strcopy()
  • copy()
  • strcpy() (correct)
  • strncpy()

How do you access members of a structure in C?

  • Using the member access operator (. ) (correct)
  • Using the member access operator (::)
  • Using the member access operator (-->)
  • Using the member access operator (->)

Which statement is used to print a string in C?

<p><code>printf()</code> (D)</p> Signup and view all the answers

What is the purpose of the int main() function in a C program?

<p>To serve as the entry point of the program (A)</p> Signup and view all the answers

In the provided example, what is the value assigned to Book1's book_id?

<p>6495407 (B)</p> Signup and view all the answers

What is the correct way to assign a string to Book1.title?

<p><code>Book1.title = &quot;Title&quot;;</code> (D)</p> Signup and view all the answers

Which function is used to compare two strings in C?

<p><code>strcmp()</code> (B)</p> Signup and view all the answers

What is the correct statement about declaring structures in C?

<p><code>struct</code> keyword is used to declare variables of structure type (B)</p> Signup and view all the answers

Flashcards are hidden until you start studying

More Like This

IT Midterm Flashcards
46 questions

IT Midterm Flashcards

TenaciousFeynman9892 avatar
TenaciousFeynman9892
It Ends With Us - English Book Talk
10 questions
IT Essentials v7.0 Chapter 8 Exam Flashcards
50 questions
Use Quizgecko on...
Browser
Browser