LinkedIn: Android | Skill Assessment Quiz Solutions-2 | APDaga Tech

▸ Android | LinkedIn Skill Assessment Quiz Solutions-2

LinkedIn: Android | Skill Assessment Quiz Solutions-2 | APDaga Tech


  1. When should you store files in the /assets directory?

    • when you need access to the original file names and file hierarchy
    • when you need access to the file with its resource ID, like R.assets.filename
    • when you have XML files that define tween animations
    • when you need to access the file in its raw form using Resources.openRawResource()


  1. You want to allow users to take pictures in your app. Which is not an advantage of creating an appropriate intent, instead of requesting the camera permission directly?

    • Users can select their favorite photo apps to take pictures.
    • You do not have to make a permission request in your app to take a picture.
    • You have full control over the user experience. The app that handles the camera intent will respect your design choices.
    • You do not have to design the UI. The app that handles the camera intent will provide the UI.


  1. When would you use the ActivityCompat.shouldShowRequestPermissionRationale() function?

    • when a user first opens your app and you want to provide an explanation for the use of a given permission
    • when a user has previously denied the request for a given permission and selects “Tell me more”
    • when a user has previously denied the request for a given permission and you want to provide an explanation for its use
    • when a user has previously denied the request for a given permission and selected “Don’t ask again,” but you need the permission for your app to function


  1. You would like to enable analytics tracking only in release builds. How can you create a new field in the generated BuildConfig class to store that value?

    • A

      buildTypes {
          debug {
          buildConfig 'boolean', 'ENABLE_ANALYTICS', 'false'
          }
          release {
          buildConfig 'boolean', 'ENABLE_ANALYTICS', 'true'
          }
      }
      
    • B

      buildTypes {
      	debug {
      		buildConfig 'String', 'ENABLE_ANALYTICS', 'false'
      	}
      	release {
      		buildConfig 'String', 'ENABLE_ANALYTICS', 'true'
      	}
      }
      
    • C

      buildTypes {
      	debug {
      		buildConfigField 'boolean', 'ENABLE_ANALYTICS', 'false'
      	}
      	release {
      		buildConfigField 'boolean', 'ENABLE_ANALYTICS', 'true'
      	}
      }
      
    • D

      buildTypes {
      	debug {
      		buildConfigField 'boolean', 'ENABLE_ANALYTICS', 'true'
      	}
      	release {
      		buildConfigField 'boolean', 'ENABLE_ANALYTICS', 'false'
      	}
      }
      


  1. To optimize your APK size, what image codec should you use?

    • JPG
    • PNG
    • MPEG
    • WebP




  1. You have built code to make a network call and tested that it works in your development environment. However, when you publish it to the Play console, the networking call fails to work. What will not help you troubleshoot this issue?

    • checking whether ProGuard -keepclassmembers have been added to the network data transfer objects (DTOs) in question
    • using the profiler tools in Android Studio to detect anomalies in CPU, memory, and network usage
    • checking for exceptions in the server logs or server console
    • checking that the network data transfer object has @SerizlizedName applied to its member properties


  1. Which code snippet would achieve the layout displayed below?
    Which code snippet would achieve the layout displayed below | APDaga

    • A

      xml
      	<androidx.constraintlayout.widget.ConstraintLayout
      	...>
      
      	<TextView
      		android:id="@+id/text_dashboard"
      		android:layout_width="match_parent"
      		android:layout_height="wrap_content"
      		android:layout_marginTop="16dp"
      		android:padding="8dp"
      		android:textAlignment="center"
      		android:text="Dashboard"
      		app:layout_constraintEnd_toEndOf="parent"
      		app:layout_constraintStart_toStartOf="parent"
      		app:layout_constraintTop_toTopOf="parent" />
      
      	</androidx.constraintlayout.widget.ConstraintLayout>
      
    • B

      xml
      	<androidx.constraintlayout.widget.ConstraintLayout
      	...>
      
      	<TextView
      		android:id="@+id/text_dashboard"
      		android:layout_width="match_parent"
      		android:layout_height="wrap_content"
      		android:layout_marginStart="8dp"
      		android:layout_marginEnd="8dp"
      		android:textAlignment="center"
      		android:text="Dashboard"
      		app:layout_constraintEnd_toEndOf="parent"
      		app:layout_constraintStart_toStartOf="parent"
      		app:layout_constraintTop_toTopOf="parent" />
      
      	</androidx.constraintlayout.widget.ConstraintLayout>
      
    • C

      xml
      	<androidx.constraintlayout.widget.ConstraintLayout
      	...>
      
      	<TextView
      		android:id="@+id/text_dashboard"
      		android:layout_width="match_parent"
      		android:layout_height="wrap_content"
      		android:layout_marginStart="8dp"
      		android:layout_marginTop="16dp"
      		android:layout_marginEnd="8dp"
      		android:padding="8dp"
      		android:textAlignment="center"
      		android:text="Dashboard"
      		app:layout_constraintEnd_toEndOf="parent"
      		app:layout_constraintStart_toStartOf="parent"
      		app:layout_constraintTop_toTopOf="parent" />
      
      	</androidx.constraintlayout.widget.ConstraintLayout>
      
    • D

      xml
      	<androidx.constraintlayout.widget.ConstraintLayout
      	...>
      
      	<TextView
      		android:id="@+id/text_dashboard"
      		android:layout_width="match_parent"
      		android:layout_height="wrap_content"
      		android:layout_marginStart="8dp"
      		android:layout_marginTop="16dp"
      		android:layout_marginEnd="8dp"
      		android:padding="8dp"
      		android:text="Dashboard"
      		app:layout_constraintEnd_toEndOf="parent"
      		app:layout_constraintStart_toStartOf="parent"
      	/>
      
      </androidx.constraintlayout.widget.ConstraintLayout>
      


  1. Which source set is _not_ available to you by default when Android Studio creates a new project?

    • test
    • androidTest
    • app
    • main


  1. Which definition will prevent other apps from accessing your Activity class via an intent?

    • A

      xml
      <activity android:name=".ExampleActivity" />
      
    • B

      xml
      <activity android:name=".ExampleActivity">
      	<intent-filter>
      		<action android:name="android.intent.action.SEND" />
      	</intent-filter>
      </activity>
      
    • C

      xml
      <activity android:name=".ExampleActivity">
      	<intent-filter>
      		<action android:name="android.intent.action.MAIN" />
      		<category android:name="android.intent.category.LAUNCHER" />
      	</intent-filter>
      </activity>
      
    • D

      xml
      <activity android:name=".ExampleActivity">
      	<intent-filter>
      		<action android:name="android.intent.action.VIEW" />
      	</intent-filter>
      </activity>
      

    Explanation: Intent filters are used to make activities accessible to other apps using intents. So we have to choose option which have no intent filter to make sure it is not accessible by intent


  1. To preserve on-device memory, how might you determine that the user’s device has limited storage capabilities?

    • Use the ActivityManager.isLowRamDevice() method to find out whether a device defines itself as "low RAM."
    • Use the Activity.islowRam() method to find out whether a device defines itself as “low RAM.”
    • Use the ConnectivityManager.hasLowMemory() method to find out whether a device defines itself as “low RAM.”
    • Make an image download request and check the remaining device storage usage.




  1. What is _not_ a good way to reuse Android code?

    • Use a common Gradle module shared by different Android projects.
    • Prefer to build custom views or fragments over activities.
    • Prefer to build activities instead of fragments.
    • Break down UI layouts into common elements and use <include/> to include them in other layout XML files.


  1. Which layout is best for large, complex hierarchies?

    • LinearLayout
    • ConstraintLayout
    • FrameLayout
    • RelativeLayout


  1. You need to upgrade to the latest version of the Android Gradle plugin. Which file should you modify?

    • root_project_dir/app/build.gradle.
    • root_project_dir/settings.gradle.
    • root_project_dir/build.gradle.
    • root_project_dir/app/gradle.properties.

    reference


  1. Why do developers often put app initialization code in the Application class?

    • The Application class is instantiated before any other class when the process for the application is created.
    • The Application class is instantiated after any permissions requests when the process for the application is created.
    • The Application class is created each time a new Activity is launched, making it ideal for initialization code.
    • The Application class is created each time a background service is called, making it ideal for initialization code.

    reference


  1. What folder should you use for your app’s launcher icons?

    • /drawable
    • /icon
    • /mipmap
    • /launcher




  1. Which drawable definition allows you to achieve the shape below?
    Which drawable definition allows you to achieve the shape below | APDaga

    • A

      xml
      <shape xmlns:android-"http://schemas.android.com/apk/res/android"
      	android:shape-"oval">
      	<gradient
      		android:startColor-"@android:color/white"
      		android:endColor-"@android:color/black"
      		android:angle-"45"/>
      </shape>
      
    • B

      xml
      <rectangle xmlns:android-"http://schemas.android.com/apk/res/android">
      <gradient
      	android:startColor-"@android:color/white"
      	android:endColor-"android:color/black"
      	android:angle-"135"/>
      </rectangle>
      
    • C

      xml
      <shape xmlns:android-"http://schemas.android.com/apk/res/android"
      android:shape-"rectangle">
      <gradient
      	android:startColor-"@android:color/white"
      	android:endColor-"@android:color/black"
      	android:angle-"135"/>
      </shape>
      
    • D

      xml
      <shape xmlns:android-"http://schemas.android.com/apk/res/android"
      android:shape-"rectangle">
      <gradient
      	android:startColor-"@android:color/white"
      	android:endColor-"@android:color/black"
      	android:angle-"98"/>
      </shape>
      


  1. Given the ConstraintLayout below, which statement is true?
    Given the ConstraintLayout below, which statement is true | APDaga

    • View B is not horizontally constrained.
    • View C has too many constraints.
    • View B is not vertically constrained.
    • View C is constrained to the parent.


  1. Given this code snippey from a build.gradle file, which choice is not a possible build variant?
    android {
        ...
        defaultConfig{...}
    
        buildTypes{
        debug{...}
        releasae{...}
    }
    
      flavorDimensions "environment"
      productFlavors {
         producation {...}
         staging {...}
      }
    }
    
    • productionDebug.
    • developmentDebug.
    • stagingDebug.
    • stagingRelease.


  1. When should you use the androidTest directory to store your test classes?

    • when the tests consist only of unit tests.
    • when the number of tests to run is large(500+).
    • when the tests need to run on your local machine.
    • when the tests need to run on real or virtual devices.

    reference


  1. Given an APK named app-internal-debug.apk produced from the build process, which statement is likely to be true?

    • This APK is created on a developer machine from the debug product flavor.
    • This APK is created from the internalDebug product flavor.
    • This APK created from the debug product flavor and internal build type.
    • This APK is created from the debug build type and internal product flavor.




  1. When attempting to build your project, what might the following error indicate?
    Conversion to Dalvik format filed: Unable to execute dex: method ID not in [0, 0xffff]: 65536

    • You have included incorect format information in your build.gradle file.
    • You have added more than 20 dependencies to your build.gradle.
    • You have exceeded the total number of methods that can be referenced within a single DEX file.
    • You have a NullPointerException in your code.


  1. Which statement, in build.gradle file, correctly denotes that the corresponding module is an Android library module?

    • apply plugin: ‘com.module.library’
    • apply plugin: 'com.android.library’
    • apply plugin: ‘com.module.library’
    • include plugin: ‘com.module.library’


  1. Given the following dimens.xml file, how would you define an ImageView with medium spacing at the bottom?

    <?xml version=1.0 encoding="utf-8"?>
    <resources>
        <dimen name="spacing_medium">8dp</dimen>
        <dimen name="spacing_large">12dp</dimen>
    </resources>
    
    • A

      <ImageView
      android:id=@+id/image_map_pin"
      android:layout_width="wrap_content"
      android:layout_heignt="wrap_content"
      android:src=@drawable/map_pin />
      
    • B

      android:id=@+id/image_map_pin"
      android:layout_width="wrap_content"
      android:layout_heignt="wrap_content"
      androi:layout_botttom="@dimen/spacing_medium"
      android:src=@drawable/map_pin />
      
    • C

      <ImageView
      android:id=@+id/image_map_pin"
      android:layout_width="wrap_content"
      android:layout_heignt="wrap_content"
      android:layout_marginBottom="@resources/spacing_medium"
      android:src=@drawable/map_pin />
      
    • D

      <ImageView
      android:id=@+id/image_map_pin"
      android:layout_width="wrap_content"
      android:layout_heignt="wrap_content"
      android:layout_marginBottom="@dimen/spacing_medium"
      android:src=@drawable/map_pin />
      


  1. what is not a benefit of externalizing app resources such as image and string from a code?

    • It allows Android to choose the appropriate resource based on the current configuration during runtime.
    • It allows you to have more performant applications because the code and resources are separated.
    • It allows you to provide a different Ul experience based on the user’s language settings.
    • It allows you to provide a different Ul experience based on the user’s device size.


  1. What is the chief purpose of line five in this code snippet?

    override fun onCreate(savedInstanceState: Bundle?) 
    { 
       super.onCreate(savedInstanceState) 
       setContentView(R.layout.activity_post_create)
    
    	if (savedInstanceState != null) return
    
    	val fragment = CreatePostFragment()
    		supportFragmentManager
    		.beginTransaction()
    		.add(R.id. fragment_container, fragment)
    		.commit()
    }
    
    • to make sure that the activity finishes when the savedInstanceState is not null
    • to make sure that the activity creates a new fragment each time it is restored from a previous state
    • to prevent the display of two fragments side by side in cases where the activity is restored from a previous state
    • to prevent the creation of overlapping fragments in cases where the activity is restored from a previous state


CREDITS: (Source)


Click here to see solutions for all HackerRank SQL practice questions.
&
Click here to see solutions for all Machine Learning Coursera Assignments.
&
Click here to see more codes for Raspberry Pi 3 and similar Family.
&
Click here to see more codes for NodeMCU ESP8266 and similar Family.
&
Click here to see more codes for Arduino Mega (ATMega 2560) and similar Family.

Feel free to ask doubts in the comment section. I will try my best to answer it.
If you find this helpful by any mean like, comment and share the post.
This is the simplest way to encourage me to keep doing such work.

Thanks & Regards,
- APDaga DumpBox
إرسال تعليق (0)
أحدث أقدم