aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • security Online Quiz - 11
  • While trying to print an eight character long name, which...
Multiple choice technology security

While trying to print an eight character long name, which of the following will introduce a security vulnerability ?

printf ("%.8s",name); /* 1 */
printf (name);  /* 2 */ 
printf ("%s",name);  /* 3 */ 
printf ("%8c", name);  /* 4 */

  1. 1 and 2

  2. 2 and 3

  3. 3 and 4

  4. only 2

Reveal answer Fill a bubble to check yourself
B Correct answer

Keep practicing — related questions

  • Which of the following is a secure way to use scanf?
  • Which of the following is a secure way to use scanf?
  • What does the following C statement print? print(“%d”, ++5);
  • What is the vulnerability in this code? int main(int argc, char * argv[]) { printf (argv[1]); }
  • What is the vulnerability in this code? char output[20]; /* Assume data is a character array with value %20...
  • int main (int argc, char *argv[]){ char chararray[3]; int intarray[3]; int i; strncpy(chararray, argv[1], s...
  • Is there a vulnerability in this code? If yes, which line(s) int main (int argc, char *argv[]){ char charar...
  • What is the vulnerability in this code? int main(int argc, char * argv[]) { printf (argv[1]); }
Play the full quiz 🎤 Practise this topic out loud
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy