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!

Q31

Q31 What could cause the "JSX expressions must have one parent element" error?

A

Using too many elements in JSX

B

Not wrapping JSX elements inside a parent element

C

Using JavaScript functions inside JSX

D

Not using semicolons properly

Q32

Q32 What is the preferred way to style components in React Native?

A

Using inline styles

B

Using external CSS files

C

Using the StyleSheet API

D

Using Bootstrap

Q33

Q33 What does Flexbox in React Native help with?

A

Handling animations

B

Managing UI layout and alignment

C

Writing JavaScript logic

D

Adding event handlers

Q34

Q34 What is the default flex direction in React Native?

A

row

B

column

C

row-reverse

D

column-reverse

Q35

Q35 Which of the following properties is used to create a responsive layout in React Native?

A

position

B

display

C

flex

D

overflow

Q36

Q36 What does justifyContent: 'center' do in React Native styling?

A

Aligns items horizontally in the center

B

Aligns items vertically in the center

C

Centers items inside a View

D

Removes extra spacing between elements

Q37

Q37 How do you apply multiple styles to a component in React Native?

A

Pass an array of style objects

B

Use multiple style attributes

C

Separate styles with commas

D

Use CSS classes

Q38

Q38 What is the correct way to define styles using StyleSheet.create?

A

StyleSheet.create({ myStyle: { color: 'blue' } })

B

StyleSheet({ myStyle: { color: 'blue' } })

C

Style.create({ myStyle: { color: 'blue' } })

D

new StyleSheet({ myStyle: { color: 'blue' } })

Q39

Q39 What will be the background color of a View with the following style:
{ backgroundColor: 'transparent' }?

A

White

B

Black

C

Transparent

D

Gray

Q40

Q40 What will happen if you set flex: 1 to a View inside a parent with flex: 1?

A

The child View will occupy the entire screen

B

The child View will be hidden

C

The child View will divide space equally with siblings

D

It will throw an error

Q41

Q41 Why is the error "StyleSheet.create is not a function" occurring?

A

Incorrect import of StyleSheet

B

StyleSheet is not supported in React Native

C

Incorrect function name

D

Styles must be defined inside the component

Q42

Q42 What could be the reason for styles not applying to a component?

A

Style object is not used

B

CSS classes are required

C

Only inline styles are supported

D

React Native does not support styling

Q43

Q43 Why does alignItems:
'center' not work as expected on a View?

A

alignItems does not exist in React Native

B

It only works if justifyContent is also used

C

It requires a parent with flex applied

D

It only works on Text components

Q44

Q44 What is the purpose of state in React Native?

A

To store local component data

B

To manage navigation

C

To handle API calls

D

To define styles

Q45

Q45 How is state defined in a functional component?

A

this.state

B

useState hook

C

setState

D

componentState

Q46

Q46 What is the key difference between state and props?

A

Props are mutable, but state is immutable

B

State is managed inside the component, while props are passed from a parent

C

Props can be changed inside the component

D

State and props are identical

Q47

Q47 What happens when state changes in a component?

A

Nothing happens

B

The component is re-rendered

C

State is reset to the initial value

D

The app crashes

Q48

Q48 Which of the following is correct about updating state in a class component?

A

State can be directly modified

B

State should be updated using this.setState

C

State updates immediately after calling setState

D

State updates are synchronous

Q49

Q49 What happens if you try to modify props inside a child component?

A

The component will update normally

B

Props will be updated automatically

C

React will throw an error

D

The update will be ignored

Q50

Q50 What is the correct syntax to define state in a functional component?

A

const [count, setCount] = useState(0);

B

this.state = { count: 0 };

C

useState({ count: 0 })

D

state = { count: 0 }

Q51

Q51 How do you pass a prop named title to a component named Header?

A

<Header title="Welcome" />

B

<Header props.title="Welcome" />

C

<Header {title} />

D

<Header @title="Welcome" />

Q52

Q52 What is the correct way to provide a default value for a prop in a functional component?

A

props.value = "Default"

B

const { value = "Default" } = props;

C

props.value || "Default"

D

Welcome.defaultProps = { value: "Default" };

Q53

Q53 Why does "Cannot read property 'setState' of undefined" occur in a class component?

A

setState is not a valid function

B

State cannot be modified

C

The component is not wrapped in a View

D

this is not bound in the constructor

Q54

Q54 What could cause a functional component to not update when state changes?

A

Not using setState

B

State updates synchronously

C

The component is inside a View

D

State can only be changed inside a class component

Q55

Q55 Why does a child component not receive updated props when the parent state changes?

A

The parent does not re-render

B

Props are immutable

C

Only class components support props

D

React Native does not support state updates

Q56

Q56 How do you handle user input in React Native?

A

Using event listeners

B

Using the onPress or onChangeText handlers

C

Using inline styles

D

Using Redux

Q57

Q57 Which method is used to handle button clicks in React Native?

A

onClick

B

onTap

C

onPress

D

onTouch

Q58

Q58 What event handler is used to capture text input changes in React Native?

A

onInput

B

onText

C

onChangeText

D

onModifyText

Q59

Q59 What is the correct way to prevent event propagation in React Native?

A

Calling event.preventDefault()

B

Calling event.stopPropagation()

C

Returning false

D

Using event.cancel

Q60

Q60 Which gesture handling library is commonly used in React Native?

A

React Navigation

B

React Gesture Handler

C

Redux

D

Context API

ad verticalad vertical
ad