03 Aug 2022

to what value are pointers initialized mcqhow to edit file in docker container

female american akita temperament Comments Off on to what value are pointers initialized mcq

Which of the following statement is correct about the references? a) 5b) 10c) 15d) it will return some random number Answer: dClarification: Array element cannot be address of auto variable. Array names Let array p base address is 200 and double ptr base address is 300, ptr++; // It points to address 202, \(\frac{{address\;of\;ptr\; - \;address\;of\;p}}{{size\;of\;int}}\; = \frac{{202 - 200}}{2} = 1\;\), char c[] = "ICRBCSIT17"; e. none of these View Answer. This set of C Multiple Choice Questions & Answers (MCQs) focuses on Initialization of Pointer Arrays 1. Index addressing mode: In index mode, the addition of base address and displacement index value gives the actual memory location. Uninitialized pointer :An uninitialized pointer stores an undefined value. Can be used for chained function calls on an object, There is no need of an extra operator for dereferencing of a reference, A reference cannot be modified once it initialized, pointer to function taking a char* argument and returns an int, function taking a char* argument and returning a pointer to int. A null pointer stores a defined value, but one that is defined by the environment to not be a valid address for any member or object. Answer d, 11. x = assignval (x, 10); // Again calls the function and x values becomes 10. Teachics.org 2021. Here,character array c will be stored to *p. int arr [ ] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 5}, *ip = arr + 4; int*ip = arr + 4 //ip is a integer pointer pointing to 5 element of the array. Which of the following statements will assign the address of the age variable to the agePtr pointer? All rights reserved. So it will print from A to J.$ g++ point1.cpp$ a.outABCDEFGHIJ. Compiler error as the return of malloc is not typecast appropriately, Compiler error because the comparison should be made as x == NULL and not as shown, Compiles successfully but execution may result in dangling pointer, Compiles successfully but execution may result in memory leak. d. Pointer referencing c. Declares and initializes a pointer variable named num2. 1. 8. b. never used D. All of above So that we can easily correct it. c. ++, d. addition and subtraction Thus, pointers to all types of data occupy the same size of memory because the value of a pointer is the memory address an unsigned integer. d. both a and b Explain Pointer to Array in C with Examples, Object Oriented Programming MCQ Questions. View Answer, 3. If you fail to select the correct option, dont worry, you can try again at the end (by refreshing the page). View Answer. int *ptr; return 0; Which of the following statements is correct? a) fgb) cdefc) defgd) abcd Answer: a Note that the first parameter is passed by reference, whereas the second parameter is passed by value. On execution, the value printed is 5 more than the integer value entered. a) char *a[][]; TEST INSTRUCTIONS:Click on options to see the answer. Register direct addressing mode. b) Output will be p Void pointer: It is a specific pointer type void * a pointer that points to some data location in storage, which doesnt have any specific type. c. int ptr = int *num1; Declares a pointer variable named num2. Consider integer size as 2 bytes. Answer b, 6. b. A. a reference can never be null return 0 ; What will be the output of the following C code? Are Expressions arrays[i] and i[arrays] same? Your email address will not be published. Option 4 : On execution, the value printed is 5 more than the integer value entered. Can we Use Pointer for Subscript to Access an Array in C Programming? } Though the address will be an integer, it is not of integer data type. e. None of these Built and grown from Kerala India . pointer concept so best option is to choose is C++. In first iteration i = 0 and 65 is assigned. What is Pointer to Pointer in C Programming, C++ Programming Questions and Answers Pointers into Arrays. c. only floating-point values. C. 2 1 x = assignval (x, 0); // It calls the function *assignval ( int *x, int val ) and x gets the value 0. if (x) { // Condition becomes true, as x means address here, x = (int *) malloc (sizeof(int)); //Again allocates memory to x and previous memory get lost, if(NULL == x) return; // condition false as x means address not NULL. Answer d, 2.following statement has the same meaning as c) hey hello how Segmentation fault a) Output will be program d. +-,-+ Since a is an integer and b is a pointer, they cant be multiplied. b. a memory address. What will be output of following program? Since c is passed by value and x is passed by reference, all functions will have the same copy of x, but different copies of c. Consider the following program in C language: Which one of the following statements is TRUE? complete set of Multiple Choice Questions and Answers, TOP 7 PROJECTS FOR BEGINNERS TO PRACTICE HTML & CSS SKILLS. Which of the following is the correct syntax to declare a 3 dimensional array using pointers? e. none of these Firstly, read all the questions and after that select the appropriate option. What will happen when the structure is declared? } Where X is an offset represented in 2s complement 16- bit representation. What is the output in a 32 bit machine with 32 bit compiler? They can be a beginner, fresher, engineering graduate or an experienced IT professional. The field student. f. both c and b c. not correctly initialized When memory location is assigned again to x, then the previous memory location gets lost and that results in memory leak problem. The questions asked in this NET practice paper are from various previous year papers. d) all of the mentioned Therefore, on execution, the value printed is 5 more than the integer value entered. Answer c, 14.Generic pointers can be declared with__________ . Also, try to share your thoughts about the topics covered in this particular quiz. C. reference doesnt need an explicit dereferencing mechanism. printf("%d",number); 10. 7. Answer d, 8. We also get your email address to automatically create an account for you in our website. A. d. Punctuation marks Ltd.: All rights reserved, Java does not support pointer concept. Which one of the following is not a possible state for a pointer.a) hold the address of the specific objectb) point one past the end of an objectc) zerod) point to a type Answer: dClarification: A pointer can be in only 3 states a, b and c. 5. What will be the output of the following C code on a 32-bit system? a. The second definition of the square will be overloaded. b. View Answer. D. all of the above The value printed by the following program is _______. R1: In this, location of the operand is a data register or an address register, memory location is itself embedded in the instruction code. Attempt a small test to analyze your preparation level. ( Security problem with pointer ). d. both a and b It can be address of static or extern variables. d) Compile-time error (adsbygoogle = window.adsbygoogle || []).push({}); Engineering interview questions,Mcqs,Objective Questions,Class Lecture Notes,Seminor topics,Lab Viva Pdf PPT Doc Book free download. -- (decrement) operator has the higher precedence than * (multiplication). Home C++ Programming Objective Questions 250+ TOP MCQs on Pointers and Answers. Which of the following is illegal?a) int *ip;b) string s, *sp = 0;c) int i; double* dp = &i;d) int *pi = 0; Answer: cClarification: dp is initialized int value of i. ptr = &x; When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. What does the following statement mean? void printxy (int x, int y) { // Here x and y becomes 1, x = 0 ; // it will make x = 0. ptr = &x;// here, ptr contains the address of x, y = *ptr; // value of y = 0, *ptr = 1; // value of x = 1, printf (%d, %d, x, y); // it will print x as 1 and y as 0, y is pointing to ptr but as * is there, value of ptr will be accesses which is same as value of x, As, it is a C program not a C++ program, so typecasting will de done automatically. document.getElementById( "ak_js_1" ).setAttribute( "value", ( new Date() ).getTime() ); Copyright 2022 QuizerMania.com | All Rights Reserved, y is a pointer to a string, x is a string, Both x and y are pointers to string types, x is a pointer to a string, y is a string, It is passed as a hidden argument to all static functions, It is passed as a hidden argument to all non-static function calls, It is passed as a hidden argument to all function calls. a. How You Can Create High Quality Backlinks In 2021? Once your account is created, you'll be logged-in to this account. All the answers in this set are correct. d. All of these are invalid This set of multiple choice questions focuses on theC++ Pointers. If the code and fee arrays are parallel, the fee that corresponds to the code stored in the code[3] element is located in the _____ element, Each element of an array is searched against the searching key, is the specialty of, A derived type that is based upon more than one fundamental type, is called. Arithmetic Expressions and Operator Precedence in C. How to insert and delete elements at the specific position in an array? d. the value of a floating-point variable So, by adding constant (offset) value to the base address, we can easily access the student.grade. Pointers are actually addresses. int *ptr; b. int ptr; Questions from Previous year GATE question papers, UGC NET Previous year questions and practice sets. D. 3 The increment operator ++and decrement operator each have two forms, that is called. }. b) 13 Answer c, 12. size of generic pointer is _______. Void refers to the type. printf (%c, %c, *( (char*) q + 1) , *( (char*) q + 2) ) ; Character a has ASCII value 97, adding 2 will result in 99, which is the ASCII value for c. *ptr = 1; d. both a and b b) hi hello how followed by 7 null values These questions can be attempted by anyone focusing on learning C++ programming language. Hence the correct answer isSize of X, Y, and Z are the same. All of them What will happen in the following C++ code snippet? A. void int number = 30; int i = 1; Practice test for UGC NET Computer Science Paper. e. none of these There is no need to do typecasting. Consider the following function implemented in C: void printxy(int x, int y) { Pre increment addressing mode, - (R1) : In this, before accessing the operand, the contents of the register are decremented to point to the previous consecutive memory location, not to the desired memory location. All of these f. both a and b Where X is an offset represented in 2s complement 16- bit representation. Using a pointer variable, without initializing it, will be disastrous, as it will have a garbage value. Here you can access and discuss Multiple choice questions and answers for various competitive exams and interviews. X (R1). printf("%d = %d\n",*(a + i),a[i]); // 4 = 4 Answer a, 7. the delete operator can be used on the pointers: f. both a and b An array of strings can be initialized by _________ 7. Clarification: Pointer ptr points to string fg. return 0; 250+ TOP MCQs on Pointers to Pointers and Answers, 250+ TOP MCQs on Pointers into Arrays and Answers, 250+ TOP MCQs on Pointers to Functions and Answers, 250+ TOP MCQs on Pointers Vs. Multi-dimensional Arrays and Answers, 250+ TOP MCQs on Pointers and Arrays and Answers, 250+ TOP MCQs on Character Pointers and Functions and Answers, 250+ TOP MCQs on Pointers to Members and Answers, 250+ TOP MCQs on Pointer to Function and Answers, 250+ TOP MCQs on Pointers and Function Arguments and Answers, 250+ TOP MCQs on Variable Length Argument and Answers, 250+ TOP MCQs on Command Line Arguments and Answers, 250+ TOP MCQs on Initialization of Pointer Arrays and Answers, 250+ TOP MCQs on Address Arithmetic and Answers. What will be the output of the following C code? View Answer. b) hi hello how followed by 7 null values TRUE. Are you curious to learn more about C++ Programming? In the last set of MCQs, we were introduced to C++ Constants. d. both a and c int main ( ) d. created with the new operator a. int* ptr; 9. b. never a. all of these What is the output of the following C code? d. Initializes a variable named *num2. Option 4 : Compiles successfully but execution may result in memory leak. Want backlinks to your website? f. both a and b ASCII of R is 82 and ASCII value of I is 73. c) char ***a; Declares a double variable named num2. Engineering 2022 , FAQs Interview Questions. There is no difference between (x==NULL) and (NULL==x ), ( == ) is just to check the equality. d) hi hello how followed by 7 nulls a) hi hello how Segmentation fault Assume that the address of x is 2000 (in decimal) and an integer requires four bytes of memory. f. both a and b The correct statement for a function that takes pointer to a float, a pointer to a pointer to a char and returns a pointer to a pointer to a integer is ____________a) int **fun(float**, char**)b) int *fun(float*, char*)c) int **fun(float*, char**)d) int ***fun(*float, **char) Answer: cClarification: Function that takes pointer to a float, a pointer to a pointer to a char and returns a pointer to a pointer to a integer is int **fun(float*, char**). FALSE, When the given code is compiled, it runs successfully, and x always points to a valid memory location and doesnt result in dangling pointer. a. special operations 6. Assume that you are running this program in little-endian processor.

How To Stimulate A Border Collie Puppy, Pomeranian Puppies For Sale In Northern Kentucky, Great Dane Puppies Western Cape, Labrador Retriever Energy Level, Chihuahua Puppies For Sale In Colorado Springs, French Bulldog X Pomeranian For Sale, Illusion Miniature Pinschers, Can I Groom My Cockapoo Myself, Rottweiler Puppies For Sale El Paso, Miniature Pomsky Puppies For Sale Near Hamburg, Bichon Frise Rescue Me Ohio, Affordable Goldendoodle Puppies Near Me,

Comments are closed.