when the user types \"Hello\"?","comment":{"@type":"Comment","text":"The onChangeText event logs every character typed into the TextInput."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"Nothing","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"The app will crash","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"Shows an alert","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"Logs Hello in the console","comment":{"@type":"Comment","text":"The onChangeText event logs every character typed into the TextInput."},"answerExplanation":{"@type":"Comment","text":"The onChangeText event logs every character typed into the TextInput."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"How can you handle a long press event on a button?","comment":{"@type":"Comment","text":"The onLongPress event fires when a user holds down a button for a specified duration."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"Using onPress","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"Using handleLongPress","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"Using onTouch","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"Using onLongPress","comment":{"@type":"Comment","text":"The onLongPress event fires when a user holds down a button for a specified duration."},"answerExplanation":{"@type":"Comment","text":"The onLongPress event fires when a user holds down a button for a specified duration."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"Why does an onPress event sometimes not trigger inside a ScrollView?","comment":{"@type":"Comment","text":"Wrapping buttons inside TouchableWithoutFeedback or using keyboardShouldPersistTaps=\"handled\" ensures that touch events work properly."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"The button is disabled","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"onPress is not supported inside ScrollView","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"The app crashed","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"The ScrollView intercepts touch events","comment":{"@type":"Comment","text":"Wrapping buttons inside TouchableWithoutFeedback or using keyboardShouldPersistTaps=\"handled\" ensures that touch events work properly."},"answerExplanation":{"@type":"Comment","text":"Wrapping buttons inside TouchableWithoutFeedback or using keyboardShouldPersistTaps=\"handled\" ensures that touch events work properly."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"Why is the keyboard not dismissing after typing in TextInput?","comment":{"@type":"Comment","text":"Calling Keyboard.dismiss() or wrapping the view in TouchableWithoutFeedback ensures the keyboard dismisses on tap outside."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"TextInput does not support keyboard dismissal","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"The keyboard needs manual closing","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"The app has a bug","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"The Keyboard.dismiss() method is missing","comment":{"@type":"Comment","text":"Calling Keyboard.dismiss() or wrapping the view in TouchableWithoutFeedback ensures the keyboard dismisses on tap outside."},"answerExplanation":{"@type":"Comment","text":"Calling Keyboard.dismiss() or wrapping the view in TouchableWithoutFeedback ensures the keyboard dismisses on tap outside."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"How can you prevent multiple button presses in quick succession?","comment":{"@type":"Comment","text":"Disabling the button temporarily prevents multiple taps and avoids duplicate actions."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"Using setTimeout","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"Using onPressPrevent","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"Using event.stopPropagation()","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"Disabling the button after the first press","comment":{"@type":"Comment","text":"Disabling the button temporarily prevents multiple taps and avoids duplicate actions."},"answerExplanation":{"@type":"Comment","text":"Disabling the button temporarily prevents multiple taps and avoids duplicate actions."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"Which library is most commonly used for navigation in React Native?","comment":{"@type":"Comment","text":"React Navigation is the most widely used library for handling navigation in React Native applications."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"React Router","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"Redux","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"NavigationX","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"React Navigation","comment":{"@type":"Comment","text":"React Navigation is the most widely used library for handling navigation in React Native applications."},"answerExplanation":{"@type":"Comment","text":"React Navigation is the most widely used library for handling navigation in React Native applications."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"Which navigator is used to create a stack-based navigation system?","comment":{"@type":"Comment","text":"StackNavigator is used to implement screen transitions in a stack-based manner, where users can navigate back and forth."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"DrawerNavigator","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"TabNavigator","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"BottomNavigator","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"StackNavigator","comment":{"@type":"Comment","text":"StackNavigator is used to implement screen transitions in a stack-based manner, where users can navigate back and forth."},"answerExplanation":{"@type":"Comment","text":"StackNavigator is used to implement screen transitions in a stack-based manner, where users can navigate back and forth."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"How do you navigate to a new screen in React Navigation?","comment":{"@type":"Comment","text":"The navigation.navigate method is used to move between screens in React Navigation."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"navigation.push(\"ScreenName\")","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"navigation.goto(\"ScreenName\")","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"navigation.load(\"ScreenName\")","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"navigation.navigate(\"ScreenName\")","comment":{"@type":"Comment","text":"The navigation.navigate method is used to move between screens in React Navigation."},"answerExplanation":{"@type":"Comment","text":"The navigation.navigate method is used to move between screens in React Navigation."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"What is the purpose of navigation.goBack()?","comment":{"@type":"Comment","text":"navigation.goBack() is used to move back to the previous screen in the stack."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"Reloads the current screen","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"Closes the app","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"Renders the navigation stack","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"Returns to the previous screen","comment":{"@type":"Comment","text":"navigation.goBack() is used to move back to the previous screen in the stack."},"answerExplanation":{"@type":"Comment","text":"navigation.goBack() is used to move back to the previous screen in the stack."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"Which of the following statements is true about deep linking in React Navigation?","comment":{"@type":"Comment","text":"Deep linking enables apps to open specific screens based on a given URL structure."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"Deep linking is only available for Android","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"Deep linking does not work with nested navigators","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"Deep linking is automatically enabled in React Navigation","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"Deep linking allows opening a specific screen from a URL","comment":{"@type":"Comment","text":"Deep linking enables apps to open specific screens based on a given URL structure."},"answerExplanation":{"@type":"Comment","text":"Deep linking enables apps to open specific screens based on a given URL structure."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"How do you define a stack navigator in React Navigation?","comment":{"@type":"Comment","text":"createStackNavigator() is used to define stack-based navigation in React Native."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"createDrawerNavigator()","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"createNavigationStack()","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"createTabNavigator()","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"createStackNavigator()","comment":{"@type":"Comment","text":"createStackNavigator() is used to define stack-based navigation in React Native."},"answerExplanation":{"@type":"Comment","text":"createStackNavigator() is used to define stack-based navigation in React Native."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"What is the correct way to pass parameters while navigating to a screen?","comment":{"@type":"Comment","text":"Parameters can be passed to a screen using navigation.navigate(\"ScreenName\", { key: value })."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"navigation.push(\"Profile\", { userId: 123 })","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"navigation.send(\"Profile\", { userId: 123 })","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"navigation.go(\"Profile\", { userId: 123 })","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"navigation.navigate(\"Profile\", { userId: 123 })","comment":{"@type":"Comment","text":"Parameters can be passed to a screen using navigation.navigate(\"ScreenName\", { key: value })."},"answerExplanation":{"@type":"Comment","text":"Parameters can be passed to a screen using navigation.navigate(\"ScreenName\", { key: value })."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"How do you access the passed parameters inside a screen component?","comment":{"@type":"Comment","text":"The route.params object is used to retrieve parameters passed to a screen."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"props.params.userId","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"navigation.route.params.userId","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"this.params.userId","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"route.params.userId","comment":{"@type":"Comment","text":"The route.params object is used to retrieve parameters passed to a screen."},"answerExplanation":{"@type":"Comment","text":"The route.params object is used to retrieve parameters passed to a screen."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"How do you dynamically set the title of a screen in React Navigation?","comment":{"@type":"Comment","text":"The setOptions method is used to dynamically update screen options such as the title."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"navigation.title = \"New Title\"","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"navigation.setTitle(\"New Title\")","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"navigation.modifyTitle(\"New Title\")","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"setOptions({ title: \"New Title\" })","comment":{"@type":"Comment","text":"The setOptions method is used to dynamically update screen options such as the title."},"answerExplanation":{"@type":"Comment","text":"The setOptions method is used to dynamically update screen options such as the title."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"Why might navigation.navigate(\"Home\") not work as expected?","comment":{"@type":"Comment","text":"The NavigationContainer must wrap the navigators for them to work correctly."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"The Home screen is missing","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"navigate is an invalid method","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"React Native does not support navigation","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"Navigation is not wrapped with a NavigationContainer","comment":{"@type":"Comment","text":"The NavigationContainer must wrap the navigators for them to work correctly."},"answerExplanation":{"@type":"Comment","text":"The NavigationContainer must wrap the navigators for them to work correctly."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"What is the best way to fix an issue where route.params is undefined?","comment":{"@type":"Comment","text":"The route.params object will be undefined if no parameters are passed while navigating to a screen."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"Manually define params in the component state","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"Reinstall React Navigation","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"Convert the component into a class component","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"Ensure the correct parameter is passed in navigate","comment":{"@type":"Comment","text":"The route.params object will be undefined if no parameters are passed while navigating to a screen."},"answerExplanation":{"@type":"Comment","text":"The route.params object will be undefined if no parameters are passed while navigating to a screen."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"What could cause a \"Navigator is undefined\" error in React Navigation?","comment":{"@type":"Comment","text":"If a valid navigator is not created using createStackNavigator(), createDrawerNavigator(), etc., React Navigation will not function properly."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"React Native does not support navigation","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"React Navigation requires Redux","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"The app needs to be restarted","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"The app is missing a valid navigation stack","comment":{"@type":"Comment","text":"If a valid navigator is not created using createStackNavigator(), createDrawerNavigator(), etc., React Navigation will not function properly."},"answerExplanation":{"@type":"Comment","text":"If a valid navigator is not created using createStackNavigator(), createDrawerNavigator(), etc., React Navigation will not function properly."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"Which function is commonly used for making HTTP requests in React Native?","comment":{"@type":"Comment","text":"Both fetch() and axios.get() can be used to make API calls in React Native."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"fetch()","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"axios.get()","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"XMLHttpRequest()","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"Both fetch() and axios.get()","comment":{"@type":"Comment","text":"Both fetch() and axios.get() can be used to make API calls in React Native."},"answerExplanation":{"@type":"Comment","text":"Both fetch() and axios.get() can be used to make API calls in React Native."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"What is the primary advantage of using Axios over Fetch API?","comment":{"@type":"Comment","text":"Axios simplifies API calls by handling JSON parsing and supporting additional features like request cancellation."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"Fetch API is faster","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"Axios only supports GET requests","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"Axios is built into React Native","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"Axios automatically parses JSON responses","comment":{"@type":"Comment","text":"Axios simplifies API calls by handling JSON parsing and supporting additional features like request cancellation."},"answerExplanation":{"@type":"Comment","text":"Axios simplifies API calls by handling JSON parsing and supporting additional features like request cancellation."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"What lifecycle method should be used to fetch data when a component mounts in a class component?","comment":{"@type":"Comment","text":"componentDidMount() is called once when a component is mounted, making it ideal for fetching data."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"componentWillUpdate()","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"componentWillUnmount()","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"constructor()","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"componentDidMount()","comment":{"@type":"Comment","text":"componentDidMount() is called once when a component is mounted, making it ideal for fetching data."},"answerExplanation":{"@type":"Comment","text":"componentDidMount() is called once when a component is mounted, making it ideal for fetching data."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"What is the recommended way to handle API errors in React Native?","comment":{"@type":"Comment","text":"Wrapping API calls in try...catch ensures proper error handling."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"Ignore the errors","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"Reload the application","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"Use console.log()","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"Use a try...catch block","comment":{"@type":"Comment","text":"Wrapping API calls in try...catch ensures proper error handling."},"answerExplanation":{"@type":"Comment","text":"Wrapping API calls in try...catch ensures proper error handling."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"What is the best approach for handling loading state when fetching data?","comment":{"@type":"Comment","text":"Showing a loading state improves user experience while waiting for API data."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"Display an error message immediately","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"Only fetch data after user interaction","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"Use setTimeout before making a request","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"Render a loading indicator until data is available","comment":{"@type":"Comment","text":"Showing a loading state improves user experience while waiting for API data."},"answerExplanation":{"@type":"Comment","text":"Showing a loading state improves user experience while waiting for API data."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"What is the correct syntax for making a GET request using Fetch API?","comment":{"@type":"Comment","text":"The fetch() function is used to make HTTP requests in JavaScript, including React Native."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"fetch.get('https://api.example.com/data')","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"axios.fetch('https://api.example.com/data')","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"get.fetch('https://api.example.com/data')","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"fetch('https://api.example.com/data')","comment":{"@type":"Comment","text":"The fetch() function is used to make HTTP requests in JavaScript, including React Native."},"answerExplanation":{"@type":"Comment","text":"The fetch() function is used to make HTTP requests in JavaScript, including React Native."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"How do you handle API responses with fetch()?","comment":{"@type":"Comment","text":"res.json() is needed to parse the JSON response from an API."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"fetch(url).then(res => console.log(res))","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"fetch(url).getData()","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"fetch(url).returnJson()","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"fetch(url).then(res => res.json()).then(data => console.log(data))","comment":{"@type":"Comment","text":"res.json() is needed to parse the JSON response from an API."},"answerExplanation":{"@type":"Comment","text":"res.json() is needed to parse the JSON response from an API."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"How can you cancel an ongoing API request in React Native using Axios?","comment":{"@type":"Comment","text":"Axios supports request cancellation using source.cancel() to prevent unnecessary API calls."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"axios.cancel()","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"fetch.abort()","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"cancelRequest()","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"source.cancel()","comment":{"@type":"Comment","text":"Axios supports request cancellation using source.cancel() to prevent unnecessary API calls."},"answerExplanation":{"@type":"Comment","text":"Axios supports request cancellation using source.cancel() to prevent unnecessary API calls."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"How do you handle multiple API calls simultaneously in React Native?","comment":{"@type":"Comment","text":"Promise.all() allows multiple API calls to be executed in parallel, improving performance."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"Use setTimeout()","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"Make requests one by one","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"Wait for one request to finish before starting another","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"Use Promise.all()","comment":{"@type":"Comment","text":"Promise.all() allows multiple API calls to be executed in parallel, improving performance."},"answerExplanation":{"@type":"Comment","text":"Promise.all() allows multiple API calls to be executed in parallel, improving performance."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"Why does fetch() sometimes fail when calling an API?","comment":{"@type":"Comment","text":"Common issues with fetch() include incorrect URLs or network errors."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"The API does not exist","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"fetch() does not work in React Native","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"APIs only work with Axios","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"Network issues or incorrect URL","comment":{"@type":"Comment","text":"Common issues with fetch() include incorrect URLs or network errors."},"answerExplanation":{"@type":"Comment","text":"Common issues with fetch() include incorrect URLs or network errors."}}},{"@type":"Question","eduQuestionType":"Multiple choice","learningResourceType":"Practice problem","name":"Practice problem","text":"Why does an API call return an empty response in React Native?","comment":{"@type":"Comment","text":"Many APIs require authentication tokens or API keys to return valid responses."},"encodingFormat":"text/html","suggestedAnswer":[{"@type":"Answer","position":0,"encodingFormat":"text/html","text":"The API response is slow","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":2,"encodingFormat":"text/html","text":"The API does not support JSON","comment":{"@type":"Comment","text":"It is the wrong option"}},{"@type":"Answer","position":3,"encodingFormat":"text/html","text":"The request method is incorrect","comment":{"@type":"Comment","text":"It is the wrong option"}}],"acceptedAnswer":{"@type":"Answer","position":1,"encodingFormat":"text/html","text":"The API requires authentication","comment":{"@type":"Comment","text":"Many APIs require authentication tokens or API keys to return valid responses."},"answerExplanation":{"@type":"Comment","text":"Many APIs require authentication tokens or API keys to return valid responses."}}}]}
React Native Multiple Choice Questions (MCQs) and Answers
Master React Native with Practice MCQs. Explore our curated collection of Multiple Choice Questions. Ideal for placement and interview preparation, our questions range from basic to advanced, ensuring comprehensive coverage of React Native concepts. Begin your placement preparation journey now!
Q61
Q61 What is the primary advantage of using Pressable over TouchableOpacity?
A
Pressable supports additional gesture states
B
Pressable has built-in animations
C
Pressable is more lightweight
D
Pressable is only available in React Native 0.50+
Q62
Q62 How do you attach an onPress event to a button?
A
<Button title="Click" onPress={handleClick} />
B
<Button title="Click" click={handleClick} />
C
<Button onClick={handleClick} />
D
<Button touch={handleClick} />
Q63
Q63 What will be the output of this code? <TextInput onChangeText={(text) => console.log(text)} /> when the user types "Hello"?
A
Nothing
B
The app will crash
C
Logs Hello in the console
D
Shows an alert
Q64
Q64 How can you handle a long press event on a button?
A
Using onLongPress
B
Using onPress
C
Using handleLongPress
D
Using onTouch
Q65
Q65 Why does an onPress event sometimes not trigger inside a ScrollView?
A
The button is disabled
B
The ScrollView intercepts touch events
C
onPress is not supported inside ScrollView
D
The app crashed
Q66
Q66 Why is the keyboard not dismissing after typing in TextInput?
A
TextInput does not support keyboard dismissal
B
The keyboard needs manual closing
C
The app has a bug
D
The Keyboard.dismiss() method is missing
Q67
Q67 How can you prevent multiple button presses in quick succession?
A
Using setTimeout
B
Disabling the button after the first press
C
Using onPressPrevent
D
Using event.stopPropagation()
Q68
Q68 Which library is most commonly used for navigation in React Native?
A
React Router
B
React Navigation
C
Redux
D
NavigationX
Q69
Q69 Which navigator is used to create a stack-based navigation system?
A
DrawerNavigator
B
StackNavigator
C
TabNavigator
D
BottomNavigator
Q70
Q70 How do you navigate to a new screen in React Navigation?
A
navigation.push("ScreenName")
B
navigation.navigate("ScreenName")
C
navigation.goto("ScreenName")
D
navigation.load("ScreenName")
Q71
Q71 What is the purpose of navigation.goBack()?
A
Reloads the current screen
B
Returns to the previous screen
C
Closes the app
D
Renders the navigation stack
Q72
Q72 Which of the following statements is true about deep linking in React Navigation?
A
Deep linking allows opening a specific screen from a URL
B
Deep linking is only available for Android
C
Deep linking does not work with nested navigators
D
Deep linking is automatically enabled in React Navigation
Q73
Q73 How do you define a stack navigator in React Navigation?
A
createDrawerNavigator()
B
createStackNavigator()
C
createNavigationStack()
D
createTabNavigator()
Q74
Q74 What is the correct way to pass parameters while navigating to a screen?
A
navigation.navigate("Profile", { userId: 123 })
B
navigation.push("Profile", { userId: 123 })
C
navigation.send("Profile", { userId: 123 })
D
navigation.go("Profile", { userId: 123 })
Q75
Q75 How do you access the passed parameters inside a screen component?
A
props.params.userId
B
navigation.route.params.userId
C
route.params.userId
D
this.params.userId
Q76
Q76 How do you dynamically set the title of a screen in React Navigation?
A
navigation.title = "New Title"
B
setOptions({ title: "New Title" })
C
navigation.setTitle("New Title")
D
navigation.modifyTitle("New Title")
Q77
Q77 Why might navigation.navigate("Home") not work as expected?
A
The Home screen is missing
B
Navigation is not wrapped with a NavigationContainer
C
navigate is an invalid method
D
React Native does not support navigation
Q78
Q78 What is the best way to fix an issue where route.params is undefined?
A
Ensure the correct parameter is passed in navigate
B
Manually define params in the component state
C
Reinstall React Navigation
D
Convert the component into a class component
Q79
Q79 What could cause a "Navigator is undefined" error in React Navigation?
A
The app is missing a valid navigation stack
B
React Native does not support navigation
C
React Navigation requires Redux
D
The app needs to be restarted
Q80
Q80 Which function is commonly used for making HTTP requests in React Native?
A
fetch()
B
axios.get()
C
XMLHttpRequest()
D
Both fetch() and axios.get()
Q81
Q81 What is the primary advantage of using Axios over Fetch API?
A
Axios automatically parses JSON responses
B
Fetch API is faster
C
Axios only supports GET requests
D
Axios is built into React Native
Q82
Q82 What lifecycle method should be used to fetch data when a component mounts in a class component?
A
componentDidMount()
B
componentWillUpdate()
C
componentWillUnmount()
D
constructor()
Q83
Q83 What is the recommended way to handle API errors in React Native?
A
Ignore the errors
B
Use a try...catch block
C
Reload the application
D
Use console.log()
Q84
Q84 What is the best approach for handling loading state when fetching data?
A
Render a loading indicator until data is available
B
Display an error message immediately
C
Only fetch data after user interaction
D
Use setTimeout before making a request
Q85
Q85 What is the correct syntax for making a GET request using Fetch API?