Practice 50 Kotlin and Android Development Questions, TechnoVlogs

Practice 50 Kotlin and Android Development Questions


Q1. Write a Kotlin program to create a simple Android Activity that displays "Hello, Android!" on the screen.
  Expected Output: Text "Hello, Android!" displayed in the Android app.

Q2. Write a Kotlin program to create a Button in an Android layout and display a Toast message when the button is clicked.
  Expected Output: "Button clicked!" displayed in a Toast message.

Q3. Write a Kotlin program to create an EditText and retrieve its text value when a button is clicked.
  Input: "Hello Kotlin"
  Expected Output: "Hello Kotlin" printed on the screen.

Q4. Write a Kotlin program to create a RecyclerView in Android and display a list of strings.
  Expected Output: List of items displayed in the RecyclerView.

Q5. Write a Kotlin program to create a simple Android app with two Activities and pass data between them using Intent.
  Input: "Hello from Activity 1"
  Expected Output: "Hello from Activity 1" displayed in Activity 2.

Q6. Write a Kotlin program to create a simple Android app with a CheckBox and display a message based on its state.
  Expected Output: "Checkbox checked" or "Checkbox unchecked" depending on the state.

Q7. Write a Kotlin program to create a simple Android app that saves a user’s input in a SharedPreference.
  Input: "Kotlin"
  Expected Output: The value "Kotlin" saved in SharedPreferences and displayed after app restart.

Q8. Write a Kotlin program to create a simple Android app that handles Button click events using OnClickListener.
  Expected Output: "Button clicked!" displayed in a Toast message.

Q9. Write a Kotlin program to create a simple Android app with an ImageView and set an image from resources.
  Expected Output: Image displayed in the ImageView.

Q10. Write a Kotlin program to create a Toast message that shows the current date and time in an Android app.
   Expected Output: Current date and time shown in the Toast message.

Q11. Write a Kotlin program to create a simple Android app with a ProgressBar that shows progress when a button is clicked.
   Expected Output: ProgressBar increases as the button is clicked.

Q12. Write a Kotlin program to create a simple Android app that uses a Spinner to select an item from a dropdown list.
   Input: Item 1
   Expected Output: "Item 1 selected" displayed in a Toast message.

Q13. Write a Kotlin program to create a simple Android app that uses a SeekBar to adjust a value.
   Input: SeekBar value 50
   Expected Output: "SeekBar value: 50" displayed in a TextView.

Q14. Write a Kotlin program to create a simple Android app that handles a TextWatcher on an EditText.
   Input: "Kotlin"
   Expected Output: "Text changed: Kotlin" displayed in a Toast message.

Q15. Write a Kotlin program to create an Android app that handles activity lifecycle methods (onCreate, onStart, onResume).
   Expected Output: Print "onCreate", "onStart", "onResume" on the console as the activity goes through the lifecycle.

Q16. Write a Kotlin program to create a simple Android app that uses the Camera API to take a photo.
   Expected Output: Photo captured and displayed in ImageView.

Q17. Write a Kotlin program to create a simple Android app that requests and handles permissions at runtime (e.g., Camera or Storage).
   Expected Output: Permission granted or denied Toast message.

Q18. Write a Kotlin program to create an Android app that uses a Menu with options for Settings and Exit.
   Expected Output: Displaying a menu with the options "Settings" and "Exit" in the app.

Q19. Write a Kotlin program to create an Android app that displays a Snackbar message.
   Expected Output: A Snackbar message "Action completed" displayed at the bottom of the screen.

Q20. Write a Kotlin program to create an Android app that uses an AlertDialog to ask the user for confirmation.
   Expected Output: A confirmation dialog with "Yes" and "No" buttons.

Q21. Write a Kotlin program to create an Android app that launches a web page using WebView.
   Expected Output: The web page is loaded and displayed in the WebView.

Q22. Write a Kotlin program to create an Android app that shows a ListView of contacts fetched from the phone’s contacts database.
   Expected Output: List of contacts displayed in the ListView.

Q23. Write a Kotlin program to create an Android app that uses Firebase Authentication for email sign-up and login.
   Expected Output: A success or failure message on sign-up/login.

Q24. Write a Kotlin program to create an Android app that stores and retrieves a list of strings in SQLite database.
   Input: ["Item 1", "Item 2"]
   Expected Output: List items are stored and retrieved successfully.

Q25. Write a Kotlin program to create an Android app that implements a DrawerLayout with NavigationView.
   Expected Output: A side navigation menu with options displayed.

Q26. Write a Kotlin program to create an Android app with a ViewPager to display multiple fragments.
   Expected Output: Swiping between multiple fragments.

Q27. Write a Kotlin program to create an Android app that uses Retrofit to fetch data from an API.
   Expected Output: Data fetched from API and displayed in the app.

Q28. Write a Kotlin program to create an Android app with a FloatingActionButton that performs a task when clicked.
   Expected Output: A task performed and a message displayed in the app.

Q29. Write a Kotlin program to create a simple Android app that allows users to pick an image from the gallery.
   Expected Output: Selected image is displayed in ImageView.

Q30. Write a Kotlin program to create an Android app that sets a Timer to show a message after 5 seconds.
   Expected Output: "Timer completed" message displayed after 5 seconds.

Q31. Write a Kotlin program to create an Android app with an ImageButton that changes its image when clicked.
   Expected Output: Image changes after button click.

Q32. Write a Kotlin program to create an Android app that uses a Handler to post delayed messages to the UI thread.
   Expected Output: Delayed message is displayed in the UI thread after a few seconds.

Q33. Write a Kotlin program to create an Android app that changes the background color of the app when a button is clicked.
   Expected Output: The background color changes to a new color after the button click.

Q34. Write a Kotlin program to create an Android app that uses the GPS location to display the user’s current location.
   Expected Output: Latitude and longitude values displayed in the app.

Q35. Write a Kotlin program to create an Android app that uses Room Database to store and retrieve data.
   Expected Output: Data is successfully stored and retrieved using Room.

Q36. Write a Kotlin program to create an Android app that handles deep linking to open a specific activity from a URL.
   Expected Output: The specific activity is opened based on the URL.

Q37. Write a Kotlin program to create an Android app with an EditText to take user input and save it in SharedPreferences.
   Input: "User Input"
   Expected Output: Saved user input in SharedPreferences.

Q38. Write a Kotlin program to create an Android app with a custom Adapter for displaying data in a ListView.
   Expected Output: Custom data displayed in the ListView.

Q39. Write a Kotlin program to create an Android app that plays a sound when a Button is clicked.
   Expected Output: Sound played on Button click.

Q40. Write a Kotlin program to create an Android app with a TabLayout to switch between different fragments.
   Expected Output: Switch between tabs and fragments.

Q41. Write a Kotlin program to create an Android app that fetches data from Firebase Realtime Database.
   Expected Output: Data displayed in the app fetched from Firebase.

Q42. Write a Kotlin program to create an Android app that uses the Camera2 API to capture high-resolution images.
   Expected Output: Image captured and displayed.

Q43. Write a Kotlin program to create an Android app that uses a ContentProvider to share data between apps.
   Expected Output: Data shared between apps successfully.

Q44. Write a Kotlin program to create an Android app that allows users to select a date using DatePickerDialog.
   Input: 2025-01-14
   Expected Output: Selected date is displayed.

Q45. Write a Kotlin program to create an Android app that allows users to make a phone call using an Intent.
   Expected Output: The phone app is opened with the phone number dialed.

Q46. Write a Kotlin program to create an Android app that uses Bluetooth to connect and send data.
   Expected Output: Bluetooth device connected and data sent.

Q47. Write a Kotlin program to create an Android app that switches themes between light and dark mode.
   Expected Output: The app theme changes based on the user’s selection.

Q48. Write a Kotlin program to create an Android app with a CountdownTimer that counts down from 10 seconds.
   Expected Output: Countdown displayed in the app from 10 seconds.

Q49. Write a Kotlin program to create an Android app that integrates Google Maps to show a marker.
   Expected Output: A map with a marker at the specified location.

Q50. Write a Kotlin program to create an Android app with a ViewPager and multiple tabs that display different content.
   Expected Output: Swiping between different content in the tabs.

Share on Social Media