React Native MCQ Banner

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?

A

fetch('https://api.example.com/data')

B

fetch.get('https://api.example.com/data')

C

axios.fetch('https://api.example.com/data')

D

get.fetch('https://api.example.com/data')

Q86

Q86 How do you handle API responses with fetch()?

A

fetch(url).then(res => res.json()).then(data => console.log(data))

B

fetch(url).then(res => console.log(res))

C

fetch(url).getData()

D

fetch(url).returnJson()

Q87

Q87 How can you cancel an ongoing API request in React Native using Axios?

A

axios.cancel()

B

source.cancel()

C

fetch.abort()

D

cancelRequest()

Q88

Q88 How do you handle multiple API calls simultaneously in React Native?

A

Use Promise.all()

B

Use setTimeout()

C

Make requests one by one

D

Wait for one request to finish before starting another

Q89

Q89 Why does fetch() sometimes fail when calling an API?

A

The API does not exist

B

Network issues or incorrect URL

C

fetch() does not work in React Native

D

APIs only work with Axios

Q90

Q90 Why does an API call return an empty response in React Native?

A

The API response is slow

B

The API requires authentication

C

The API does not support JSON

D

The request method is incorrect

ad verticalad vertical
ad